Netlify renders 404 on page refresh, before loading the correct page


I’m facing, what seems to be a rather common issue with Netlify, which is the infamous “when I refresh my page on a perfectly good URL, Netlify displays my 404 page briefly before rendering the correct associated page”.
And of course, I don’t have this issue locally, so I have to deploy every little fix idea I have every 5 minutes to check if it actually does something :sweat_smile:

If I’m here, it’s because unfortunately in my case, adding a _redirects file in my public/ folder with this line /* /index.html 200 doesn’t change a thing !
I tried adding a .txt to the _redirects file, in case this was coming from my compiler.
Obviously, I’ve tried the alternative way with a netlify.toml and this config :
[[redirects]] from = "/*" to = "/index.html" status = 200
But still no change…

I’m doing a full front-end routing in React.
Here is the URL of my app and a valid URL to reproduce my issue

Thank you very much in advance for your help :pray:

Hi @philoutre,

The most recent deploy of your dev branch shows that no redirect rules were processed:

(Log here: Netlify App).

This would indicate either a syntax error in the file, or the file not existing in the publish folder while publishing. Adding .txt is not a solution, the file should be precisely named _redirects. From the looks of it, the TOML file should work, but I can’t say for sure why it’s not working without checking your repo. (I am assuming that you’ve not added the redirects in the TOML file in one line like you’ve pasted here, your commit message also says the same. If you’ve indeed added it all in one line, it won’t work.)

Your approach in fixing this error is correct, what you’re trying to do is also correct, but somewhere something is going wrong.