Skip to content

Rewrite path of moved section of a website

Create a rewrite URL rule (part of Transform Rules) to rewrite everything under /blog/<PATH> to /marketing/<PATH>.

To rewrite everything under /blog/<PATH> to /marketing/<PATH> you must modify the first component of the path (/blog/). Create a rewrite URL rule and use the regex_replace() function for this purpose:

Text in Expression Editor:

starts_with(http.request.uri.path, "/blog/")

Text after Path > Rewrite to... > Dynamic:

regex_replace(http.request.uri.path, "^/blog/", "/marketing/")

The regex_replace() function matches the path component on a regular expression (^/blog/) and then provides a replacement for that match (/marketing/).