Bulk redirect preserve path suffix not working

G’day, I’m trying to redirect the www subdomain to the root domain for our Cloudflare Pages site.

I followed the ’ Redirecting www to domain apex’ guide in the Cloudflare Pages docs (https://developers.cloudflare.com/pages/how-to/www-redirect/).

AAAA record and bulk redirect list are setup as follows:

When I visit the site root www.pathoftrees.com I get a 301 redirect to https://pathoftrees.com as expected.

However, when I visit a sub-path this always redirects to the site root without preserving the path suffix.


  • Visit: www.pathoftrees.com/about
  • Expected: 301 redirect to https://pathoftrees.com/about
  • Got: 301 redirect to https://pathoftrees.com

What do I need to adjust to have path suffixes preserved in the redirect?

1 Like

I’m also experiencing this issue. It seems to only occur when the hostname is changing (e.g. to or from www). I currently have to disable these rules because it is breaking lots of links.

I reached out to Cloudflare support for help as this really stumped me. They shared some useful information which I’ve reposted below in case anyone else runs into a similar problem.

From Cloudflare support

(A) To redirect a subpath of www to the same subpath of the root domain, create a normal page rule with the following arguments:

(B) Page rules cannot be applied to pages.dev domains

(C) In order to setup a redirect on pages.dev you can use a _redirects file would look something like this:

/about https://pathoftrees.com/about-us 301

Note that the paths cannot match or it will create a redirect loop. Further details at: https://developers.cloudflare.com/pages/platform/redirects/


I have discovered that a bulk redirect can be applied to a pages.dev domain. So my final solution is:

  • Set up a www subdomain as per: https://developers.cloudflare.com/pages/how-to/www-redirect/
  • Use the page rule approach above to redirect the www subdomain to domain root (preserving subpaths)
  • Add a bulk redirect from our pages.dev domain to the root of our custom domain

Hopefully this helps anyone else struggling with this same topic :slight_smile:

1 Like

Thanks for posting this. Did they suggest that the original problem is a known issue that they are working on fixing, or was the “Redirecting www to domain apex” guide produced in error?

I did ask this but didn’t get an answer. Bulk redirects doesn’t seem to work in the way I was expecting. I’ve suggested some improvements to that doc and I might see if I can submit these as a PR to the doc as it really threw me.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

In a more recent thread, it turns out you need a trailing slash on the Target URL in order for Preserve Path Suffix to work: