Can't get a dynamic regex_replace redirect rule to save

I’m trying to create a Redirect rule to take any inbound URIs that include “/guidebook/type1”, and redirect them to a new, parameterised URL using a new prefix.

I believe I’ve written a meaningful regex_replace function, but I"m new to regex, and I can’t seem to get the rule to save, so I’m unsure if I’m doing something wrong. The domain in question is on a business plan (which I read should mean regex are available in rules.)

For example, I’m trying to redirect THIS:


The regex I’ve drafted is this:

The option to save a draft or deploy are inactive, which feels like there’s some kind of in-page validation that’s rejecting my rule. Is my replacement function is incorrectly formed, or is there something else that could be blocking me from saving / applying the redirect rule?

Hmmm… it looks like I might actually be missing edit access to redirect rules. Would still appreciate any feedback on My First Regex :sweat_smile:, and will confirm as soon as I’ve unravelled the permissions issue (I feel pretty silly for assuming those permissions were all in place!)


You could make use of concat() to render the dynamic URL expression easier to read. Start the old path regex with the ^ caret to make the match less ambiguous: You do not need to escape forward slashes.

concat("", regex_replace(http.requesturi.path, "^/old path regex", "/new path + query regex")

Assuming you want to match and capture “new-york” or variations that may have one or more hyphenated words, you’d need to double escape both w and - inside the []. So:


As for the new path and query, since we already concatenated the hostname, you need only to insert a / to replace the original slash from the path:


I hope it works, but as with any regex, please test, test, then test again with multiple variations of input URL to make sure this won’t unintentionally break something.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.