Skip to content

Knowledgebase

Creating a Cloudflare Single Redirect for an old URL

performance

A Single Redirect can send visitors from one old URL to its intended replacement before the request reaches the hosting server. Match precisely and preserve only the URL components the destination needs.

Check access and requirements

Confirm the source hostname is proxied through Cloudflare and has working TLS where HTTPS is used. Test the destination and record existing redirects that could create a loop.

01 Create a Cloudflare Single Redirect for an old URL

  1. Open Rules > Overview and choose Create rule > Redirect Rule.
  2. Name the rule and select an exact custom condition or a carefully reviewed wildcard pattern for the old URL.
  3. Enter the destination and appropriate status code. Decide explicitly whether to preserve the query string.
  4. Review rule order and deploy. For an uncertain temporary move, test a temporary redirect before committing to permanent behaviour.
  5. Request the old URL and representative nonmatching URLs. Confirm the Location header, final status, retained query values and absence of a loop.

02 Example: redirect one retired guide and test its neighbours

For a guide moved from /old-guide/ to /new-guide/, an exact Cloudflare Single Redirect condition can keep the change narrow. Confirm the source hostname is proxied and the destination already works before deploying the rule.

Code or configuration example
http.host eq "example.com" and
http.request.uri.path eq "/old-guide/"

Set the static destination to https://example.com/new-guide/. Test a temporary 302 first when the mapping is still under review, then use the intended permanent status after confirmation. Decide whether the old query string carries meaningful information before enabling preservation or discarding it.

Expected result: The exact old path reaches the new article through one deliberate redirect, while /old-guide-extra/, another hostname and the new guide itself do not match this rule. Update internal links to the new URL so readers do not need the redirect on every visit.

Confirm the expected result

The old address should reach the correct replacement through a short redirect chain, while unrelated pages remain unchanged. Update internal links to point directly to the new destination.

Resolve setup problems

A rule will not run on ordinary DNS-only traffic that bypasses Cloudflare. Wildcard captures can also send unexpected path fragments to the target if the pattern is too broad. Keep a list of deliberate examples and counterexamples for testing.

Can a redirect rule match a specific query parameter?

Use an appropriate custom filter expression when the query affects which old resource is being redirected. A broad path-only match can send several distinct resources to the same wrong destination.

Sources and further reading

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support