Convert Cloudflare Page Rules to Redirect Rules
Page Rule creation has been off since January 2025 and Cloudflare is migrating what is left. Each Forwarding URL Page Rule becomes one Single Redirect, and the only part that trips people up is the capture numbering. This page shows the timeline, works through Cloudflare's own two examples, and gives you a builder that does the conversion, one rule or a batch.
The timeline
On 6 January 2025 Cloudflare disabled the creation of new Page Rules for every account. Rules that already existed keep running. Cloudflare has said it will migrate remaining Page Rules automatically in late 2025 or beyond, and its migration guide maps each Page Rule setting to its replacement. Forwarding URL rules map to Single Redirects, the zone-level Redirect Rules under Rules in the dashboard.
Migrating yourself, before the automatic pass, means you choose the status code, decide whether each rule should match both http and https, and can test each redirect on the live zone. It also means you catch the rules that never quite worked.
The two migration-guide examples, worked through
Both come from Cloudflare's Page Rules migration guide. The difference between them is whether the rule fixes the scheme.
1. Redirect www to the apex, keeping the path
Page Rule URL www.example.com/*, forwarding to https://example.com/$1, status 301.
# custom filter expression (both schemes)
http.request.full_uri wildcard "http*://www.example.com/*"
# target URL, dynamic
wildcard_replace(http.request.full_uri, "http*://www.example.com/*", "https://example.com/${2}")
2. Move a section to a new path
Page Rule URL example.com/old-path/*, forwarding to https://example.com/new-path/$1.
# API body, phase http_request_dynamic_redirect (both schemes)
{
"expression": "http.request.full_uri wildcard \"http*://example.com/old-path/*\"",
"action": "redirect",
"action_parameters": {
"from_value": {
"status_code": 301,
"target_url": { "expression": "wildcard_replace(http.request.full_uri, \"http*://example.com/old-path/*\", \"https://example.com/new-path/${2}\")" },
"preserve_query_string": true
}
}
}
Doing it in the dashboard
- Open the zone, then Rules, then Redirect Rules (Overview), and create a rule.
- Pick Wildcard pattern. Paste the request URL pattern and the target URL from the builder, choose the status code, and turn on preserve query string.
- Or pick Custom filter expression, paste the match expression, set the URL redirect type to Dynamic and paste the
wildcard_replace()expression as the target. - Deploy, then request one old URL with
curl -Iand check theLocationheader. Test one URL with a query string too. - Disable the Page Rule once the redirect answers correctly, so the zone has one source of truth and the automatic migration has nothing left to guess at.
The builder
The same tool as the builder page. Page Rule mode takes the Page Rule URL and Forwarding URL as you have them, with $1, and applies the shift.
The rule appears here in five shapes: dashboard fields, custom expression, regex (Business or Enterprise), API JSON and Terraform. Each has a Copy button.
A whole zone of Page Rules
One rule per line as source -> target [status]. Free up to 10 rules per call; Pro removes the cap. The response has one rules[] array for the API and one Terraform resource.
Frequently asked questions
When were Cloudflare Page Rules deprecated?
Cloudflare disabled the creation of new Page Rules for all accounts on 6 January 2025. Existing Page Rules keep working, and Cloudflare has said it will migrate them automatically in late 2025 or beyond. Forwarding URL Page Rules map to Single Redirects (Redirect Rules).
What replaces a Forwarding URL Page Rule?
A Single Redirect in the zone's Redirect Rules. The Page Rule URL becomes a wildcard request URL pattern that includes the scheme, the Forwarding URL becomes the target URL with ${N} placeholders in place of $N, the status code carries over, and preserve query string is enabled.
Why does $1 become ${2} in the migrated rule?
When the request URL pattern is http*://www.example.com/* the * in http* is the first wildcard, so it is capture ${1} and the path wildcard is ${2}. Cloudflare's migration guide shows this: the target is https://example.com/${2}. If you fix the scheme with https://www.example.com/* the target stays https://example.com/${1}.
Can I migrate many Page Rules at once?
Yes. The builder's bulk mode takes one rule per line as source -> target [status] and returns a combined rules[] array for the http_request_dynamic_redirect ruleset plus a Terraform resource. Free up to 10 rules per call; a Pro key removes the cap. Single Redirects limits differ by plan, so check your zone's limit before publishing.
Need the same rules in another format? The converter moves redirects between .htaccess, nginx, Netlify, Vercel, Next.js and Cloudflare Bulk Redirects. Exact-match rules with no wildcard can go straight into a Bulk Redirects list instead.