Which redirect wins when Cloudflare Pages rules overlap?

The Citead team, updated

In short. For duplicate source paths, Cloudflare Pages applies the topmost _redirects rule; static rules belong before dynamic rules, and Bulk Redirects run before Pages.

Definition: Redirect precedence determines which rule takes effect when rules overlap. As of 17 October 2026, Cloudflare Pages documents topmost-rule precedence for duplicate source paths in _redirects and instructs authors to place static redirects before dynamic redirects.

Key facts

  • Cloudflare's Redirects documentation says the topmost redirect applies when several rules have the same source path. A matching asset does not override the redirect.
  • Cloudflare's Headers documentation gives redirects priority when a request matches both a redirect and a header rule.
  • Cloudflare's Functions routing documentation provides an exclude setting in _routes.json that takes priority over include when deciding whether Functions run.

How should overlapping rules be ordered?

The per-file instructions specify topmost precedence for duplicate source paths and say static redirects should precede dynamic redirects. Static rules use literal paths; dynamic rules use matching patterns such as wildcards or named placeholders.

This illustrative _redirects file follows the documented syntax:

/home / 301
/home /archive 302
/blog/* /posts/:splat

For /home, the first line selects / with status 301. Moving the second line above it changes the selected destination to /archive with status 302. Removing the duplicate avoids making that destination depend on file order.

The wildcard *, called a splat, greedily matches characters; :splat inserts the matched value into the destination. The example's blog rule omits a status code, so it uses the documented default of 302. Literal exceptions belong above dynamic rules, following Cloudflare's ordering instruction.

Can an existing file or header rule take priority?

Cloudflare's redirect matching instructions say redirects apply even when an asset matches the incoming request. Keeping a file at an old path therefore leaves a matching redirect in effect.

The same documentation places redirect processing before header processing. A matching _headers rule cannot take priority over that redirect. Separately, Cloudflare's header matching rules combine headers from multiple matching patterns. Header-rule accumulation and redirect selection follow different documented rules.

Where do Bulk Redirects fit?

Bulk Redirects are Cloudflare's separate redirect facility, which the Pages documentation recommends for redirect sets exceeding _redirects limits. It places Bulk Redirects in front of the Pages project when duplicates exist.

Cloudflare illustrates a Bulk Redirect from abc.com to xyz.com, followed by a Pages _redirects rule from xyz.com to foo.com. The request eventually reaches foo.com. A Pages file's line order therefore addresses only part of a configuration that also uses Bulk Redirects; the earlier Bulk Redirect can lead to another redirect at the destination.

What changes when Pages Functions serve the request?

Pages Functions execute application code for designated routes. Cloudflare's Redirects documentation excludes requests served by Functions from _redirects processing, even when their URL matches a redirect pattern. It instructs authors to implement the behavior in the appropriate Function or exclude the route from Functions.

Cloudflare's routing documentation places _routes.json in the build directory and gives exclude priority over include. Its example excludes /build/* while including other paths:

{
  "version": 1,
  "include": ["/*"],
  "exclude": ["/build/*"]
}

That exclusion concerns Function invocation. Redirect ordering within _redirects remains governed by the redirect file's rules.

FAQ

Does the last duplicate redirect win?

Cloudflare's per-file instructions select the topmost rule for duplicate source paths. You can remove duplicates and put static rules before dynamic rules when reviewing the file.

Does a proxy rule chain through another proxy rule?

For status 200 proxy rules, the same documentation shows /a /b 200 followed by /b /c 200. A request for /a renders /b; it does not continue to /c through the second proxy rule.

Where does the redirect file belong?

You place _redirects, without a file extension, in the project's static asset directory. The same documentation names public/ and static/ as common framework directories whose contents reach the build output.

Sources

  1. Cloudflare, "Redirects", updated 25 August 2026
  2. Cloudflare, "Headers", updated 25 August 2026
  3. Cloudflare, "Routing", updated 18 September 2026

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark