Skip to content

Rewrite path of archived blog posts

Create a rewrite URL rule (part of Transform Rules) to rewrite any requests for /news/2012/... URI paths to /archive/news/2012/....

To rewrite all requests to /news/2012/... to /archive/news/2012/... you must add a reference to the content of the original URL. Create a new rewrite URL rule and define a dynamic URL path rewrite using an expression:

Text in Expression Editor:

starts_with(http.request.uri.path, "/news/2012/")

Text after Path > Rewrite to… > Dynamic:

concat("/archive", http.request.uri.path)

The filter uses the starts_with() function all paths starting with /news/2012/. The dynamic path rewrite uses the concat() function to concatenate a prefix to the original URL path of the HTTP request.