CF Pages: A non-existent address always opens the main page

I noticed this behavior:
example.com → works properly (load index.html)
example.com/existing-path.html → works properly
example.com/non-existent-any-path → load the main page (index.html)
Is this the correct behavior? Shouldn’t the “Not Found” error appear?

You need to add a 404.html to your project for it to be able to render a “Not Found” page - otherwise it acts in “SPA mode” and takes you to the index page.

https://developers.cloudflare.com/pages/platform/serving-pages/#not-found-behavior

2 Likes

Thank you very much!
I don’t know what happened that I didn’t find this information, although I was looking :wink:

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