// Master HTTP redirects — status codes, patterns, conditional routing, live trace
Preserve, strip, or transform query parameters with dynamic expressions.
Your old site used /product?id=123. Your new site wants clean URLs like /products/123. Cloudflare Redirect Rules can extract query parameters and inject them into the path — giving you SEO-friendly URLs without breaking old bookmarks or inbound links.
/product?id=123 → /products?id=123
concat("/products", http.request.uri.query)/old-clean?utm_source=x → /clean
"/clean" (no .query reference)/item?id=456 → /items/456
regex_replace() to pull id from query into pathKeep useful params, strip UTM
regex_replace() to remove only utm_* parametershttp.request.uri — Full URI including query stringhttp.request.uri.path — Path only, no queryhttp.request.uri.query — Query string only (includes leading ?)concat(a, b, c) — Join strings togetherregex_replace(input, pattern, replacement) — Transform with regex capture groupsClassic redirect scenarios: HTTPS enforcement, WWW canonicalization, path rewrites.
A company rebrand moved blog.oldcorp.com/post/123 to newcorp.com/blog/article/123. Thousands of inbound links depend on the old URLs. One wildcard redirect preserves every one of them.
Redirect http:// to https://
http://redirect-rules.nobledemos.com/www.redirect-rules → redirect-rules
/old-blog/* → /blog/*
/contact → /about/contact
Route users based on country, device, or language preference.
Visitors from Germany land on /de automatically. Without edge redirects, you ship a 400kb JS bundle that reads navigator.language and client-side redirects — 2 seconds slower, bad for SEO, bad for Core Web Vitals.
Redirect based on cf.country (edge-computed)
Googlebot & Bingbot on / → /bot-welcome
http.user_agent contains "Googlebot"Browsers can't spoof User-Agent, so test with curl:
Simulate a bot request from the browser
Follow redirect chains with real fetch({redirect: 'manual'}) calls.
Users complaining your site is slow? They might be hitting a 4-hop redirect chain: http → https, www → root, /old → /new, then the final page. Each hop is a full round trip. Trace it and collapse them into one.