How to redirect a URL in Cloudflare
To redirect a URL in Cloudflare, go to Rules → Overview, select Create rule → Redirect Rule, and enter the old address as a wildcard pattern and the new one as the target URL. Pick 301 and select Deploy. The hostname has to be proxied through Cloudflare (the orange cloud in DNS) for the rule to run.
Redirect checkerUpdated 4 min read
These steps follow Cloudflare's Rules documentation. Cloudflare calls these Single Redirects; the dashboard calls them Redirect Rules.
Create a redirect rule
- In the Cloudflare dashboard, open your domain and go to Rules → Overview.
- Select Create rule → Redirect Rule. You can start from a template here, such as redirecting the root to www.
- Give the rule a name you'll recognise later.
- Under When incoming requests match, choose Wildcard pattern and type the old address in Request URL. An asterisk matches anything, for example
https://example.com/blog/*. - Under Then, enter the Target URL. It can be fixed (
https://example.com/news) or reuse the parts the asterisks matched, such ashttps://example.com/news/${1}. - Choose the Status code and whether to Preserve query string.
- Select Deploy, or Save as Draft if you aren't ready.
Cloudflare's other options are All incoming requests, which redirects everything on the domain, and Custom filter expression, for conditions such as country or device.
A worked example: root to www
Cloudflare's own example sends example.com to www.example.com and keeps the path:
- Request URL:
https://example.com/* - Target URL:
https://www.example.com/${1} - Status code: 301
- Preserve query string: on
So https://example.com/products/ goes to https://www.example.com/products/. Cloudflare points out that this rule leaves http://example.com untouched, because the pattern starts with https. To catch both, use http*://example.com/* and change the target to https://www.example.com/${2}, because the first asterisk now matches the "s".
Status codes and query strings
Cloudflare's settings page lists four codes, with 301 as the default:
- 301: permanent. Use it when a page or site has moved for good.
- 302: temporary. The old address is expected to come back.
- 307 and 308: temporary and permanent versions that keep the request method, for forms that post data.
Preserve query string is off by default. Turn it on if your links carry tracking tags such as utm_source, or they'll be dropped at the redirect.
Plans and limits
Cloudflare lists Single Redirects on every plan. The number of rules per domain is 10 on Free, 25 on Pro, 50 on Business and 300 on Enterprise, and regular expressions need Business or above. For a long list of fixed old-to-new addresses, Bulk Redirects lets you upload them as a list instead: 10,000 URL redirects on Free.
Check it works
Paste the old address into the checker after you deploy. It shows every hop and flags any redirect that isn't permanent. If you see two hops where you expected one, your server or another rule is redirecting too.
Redirect checker
Open the full toolWhy a Cloudflare redirect isn't working
- The hostname isn't proxied. Cloudflare says redirect rules need traffic for the hostname to pass through its network. If the DNS record is grey-clouded (DNS only), or there's no record at all, the rule never runs. The dashboard offers to create or proxy the record when you save a rule that names a hostname.
- The pattern doesn't match.
https://example.com/*doesn't match http, www or other subdomains. Paste the exact address you're testing and compare it with the pattern. - Something else answers first. Your origin server, an older Page Rule or your CMS may redirect the same address. The checker lists every hop, so an extra one stands out.
- A loop. A rule that redirects www to the root, plus a server setting that redirects the root to www, sends visitors round in circles. The checker stops and says so.
- Your browser remembers. Browsers cache 301s. Test in a private window.
For redirects on a server you run, see how to redirect a URL with .htaccess. To keep chains short, read redirect chains.
Sources
- Create a redirect rule in the dashboard (Cloudflare Rules docs), checked 2026-11
- Single Redirects: available settings (Cloudflare Rules docs), checked 2026-11
- Redirects (Cloudflare Rules docs), checked 2026-11
- Redirect from root to WWW (Cloudflare Rules docs), checked 2026-11
- Rules troubleshooting (Cloudflare docs), checked 2026-11
Questions
Does Cloudflare do redirects?
Yes. Single Redirects (Redirect Rules) and Bulk Redirects are available on every Cloudflare plan, including Free. The number of rules depends on the plan.
How do I set a redirect URL in Cloudflare?
Go to Rules → Overview, select Create rule → Redirect Rule, enter the old URL as a wildcard pattern, the new URL as the target, pick 301 and select Deploy.
Why isn't my Cloudflare redirect working?
Most often the hostname isn't proxied through Cloudflare (orange cloud), the pattern doesn't match http and https as you expect, or another rule or your server redirects first. Check the address with the redirect checker to see which hop answers.
How do I set up a URL redirect for a whole domain in Cloudflare?
Create a Redirect Rule with All incoming requests, or a wildcard pattern such as https://old.example/*, and a target like https://new.example/${1}. The old domain needs a proxied DNS record in Cloudflare for the rule to run.