SiteTidy
Home /Tools /Cloudflare Redirect Rule Helper

Cloudflare Redirect Rule Helper

Easily write expressions and concat targets for Cloudflare's Single Redirects and Dynamic Redirect Rules.

Cloudflare Redirect Builder

Visually construct complex Cloudflare Single Redirect Rules. Generate precise Filter Expressions and Dynamic URL Payloads without writing custom functions.

Routing Strategy

Cloudflare Configuration

Valid
(http.request.full_uri eq "https://example.com/old-page")
Static String
"https://example.com/new-page"

Implementation Notes

In Cloudflare, navigate to Rules > Redirect Rules. Create a new rule. For the incoming requests matching phase, click "Edit expression" and paste the Filter above. For the URL redirect section, ensure you select "Static" as the type before pasting the Payload.

How to use Cloudflare Redirect Rules

Cloudflare's Single Redirects (under Rules > Redirect Rules) allow you to conditionally redirect traffic at the edge before it ever reaches your server.

1. Filter Expression

This is the "If..." part of the rule. You can write custom expressions using fields like http.request.full_uri, http.request.uri.path, or ip.geoip.country. Paste the generated Filter Expression into the Expression Editor in the Cloudflare dashboard.

2. URL Redirect

This is the "Then..." part of the rule.

If your rule simply forwards to an exact URL, select Static type in Cloudflare and paste the output.

If your rule preserves parts of the path (like keeping the rest of the URL when moving a folder to a subdomain) or enforces HTTPS, select Dynamic type. Cloudflare uses functions like concat() and substring() to build the final URL.

Avoid Redirect Loops!

When doing domain-wide redirects or folder redirects, make sure your Filter Expression excludes the new target, otherwise the browser will get stuck in an infinite redirect loop (ERR_TOO_MANY_REDIRECTS).

Related Guides

Deepen your understanding with our expert articles.