[ Web Proxy ]
URL:
Viewing: https://developers.cloudflare.com/rules/transform/examples/rewrite-path-archived-posts/ [Back]  [Original]

Rewrite path of archived blog posts Cloudflare Rules docsSkip to content
SearchCtrlKLog in
  1. Home
  2. /Rules
  3. /
  4. /Examples
  5. /Rewrite path of archived blog posts

Rewrite path of archived blog posts

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

Last updated Oct 13, 2025Copy as MarkdownView as MarkdownAgent setup

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 URL rewrite rule and define a dynamic URL path rewrite using wildcard pattern parameters:

When incoming requests match

  • Wildcard pattern
    • Request URL: https://<YOUR_HOSTNAME>/news/2012/*

Then rewrite the path and/or query

  • Target path: [/] news/2012/*
  • Rewrite to: [/] archive/news/2012/${1}

Make sure to replace <YOUR_HOSTNAME> with your actual hostname and adjust the example paths according to your setup.

PreviousRewrite path for object storage bucketNextRewrite path of moved section of a website

Was this helpful?

YesNo
Edit pageReport issue
[]

Web Proxy Viewer  |  New URL  |  Original Page