Dynamic Wildcard Redirect Rule

We are working on bringing wildcard support to the Ruleset Engine this year and making user experience straightforward when it comes to redirects.

For now, I can suggest expressing the same rule using substring and concat functions to replace old path with a new one:

Filter expression:

(starts_with(http.request.uri.path, "/old-path/"))

Dynamic URL redirect expression:

concat("/new-path/", substring(http.request.uri.path, 10))

where start byte value (10 in my example) is the length of the old path.

If you are on Business or Enterprise, you can also use regex_replace if you are more comfortable with regular expressions syntax. I’ve provided some examples here for reference.

3 Likes