_redirect file exists, but it's ignored on CloudFlare Pages build

I’m migrating some websites from Netlify to Cloudflare Pages and during this process I ran into this issue.

I created a _redirects file in the root of the repository, added the URIs following the instructions in the documentation, but this is not working.

Per Redirects · Cloudflare Pages docs

To use redirects on Cloudflare Pages, declare your redirects in a plain text file called _redirects without a file extension, in the output folder of your project.

1 Like

As I’m using Hugo and the project will be built in a public folder, I moved the _redirects there, removed the public folder from my gitignore and it worked. Thank you Walshy!

If you don’t want your public in git, you can put the _redirects file in static and it will end up in public at build time.

1 Like

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