I’m new as react developer and I’m trying to build my custom error page using the redirects on the react docs and I few videos on the youtube, but is not working.
I’m deplying using the the github through the netlify trigger.
Maybe I’m putting on the wrong folder I will explain better.
Inside the public folder I have the netlify.toml,404.html and inside the netlify.toml has [[redirects]] from = "/*" to = "/error" status = 404
On the 404.html has a script tag <script type="text/javascript"> window.location.href = window.location.origin + "/error"; </script>
On the src/pages/error.js has component error.js.
My app works but when I put anything after the “/” looks like is trying to refresh the page on a infinite loop.
As mentioned in the File based configuration documentation, a netlify.toml file should go at the root of the repository. A _redirects file as mentioned in the Static routing overview goes in the publish directory—which in the case of React means putting it in the public directory.
I was reading and reading the docs but it wasn’t clear as you mentioned it.
Thanks so much!!
I didn’t realize that I had to include in the _redirects just that lile /* /index.html 200 would take care of everything. I believe any page would work with just that line.