My Web app is this below.
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.
public folder I have the
404.html and inside the
[[redirects]] from = "/*" to = "/error" status = 404
404.html has a script tag
src/pages/error.js has component
My app works but when I put anything after the “/” looks like is trying to refresh the page on a infinite loop.
I don’t have any clue what I am doing wrong.
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
For an SPA like React, especially if using React Router, you will generally want a single rule as outlined in
[Support Guide] Direct links to my single page app (SPA) don't work
from = "/*"
to = "/index.html"
status = 200
/* /index.html 200
Man you saved my life hahahah.
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.
April 10, 2023, 4:03pm
Thanks for coming back and letting us know you resolved your issue!