I recently deployed my single page react application. Everything was looking fine until I tried refreshing the about page and received the Page not found error. When moving to different pages from the “/” i.e home page it works but refreshing any other page apart from the home page gives the error. Here’s the link.
A screenshot of the error is attached
perry
May 15, 2020, 12:26am
2
hey there,
this might help:
Last reviewed by Netlify Support - August, 2023
If you’re building a Single Page Application (SPA), or an app that manages its own routes (url paths), you’ll want to add a _redirects file to your publish directory with the following line to take advantage of browser history pushstate:
/* /index.html 200
You can read more information in our docs, which can be found here .
or this:
Last reviewed by Netlify Support - August, 2023
Netlify attempts to lookup a file based on several xor filters, and when all of these fail, we end up serving a 404 page. For example, a request made to /example/ would check /example/index.html, /example.html, /example/home.html and several other combinations (not necessarily in the same order) before hitting the 404. However, in case you were not expecting a 404 at a particular URL, you might be interested in finding out the reason and potentia…
If you are still seeing issues after following the troubleshooting steps in this guide, please let us know!
Thank you for the reply. I added a _redirects text file to the build folder and redeployed and I’m still having the same issue. The deploy summary also shows no errors.
perry
May 15, 2020, 12:40am
4
hm, yes, it doesn’t show any errors but also isn’t showing that your redirects are being processed either
could you post the content of your redirects file please?
Just to be certain I named the file “_redirects.txt”
perry
May 15, 2020, 12:48am
6
AH! it can’t be a txt file. Just _redirects
- no file extension. Try that.
Oh my!. You’re a life saver! Muchas gracias amigo. .
It’s working perfectly and the deploy summary shows 1 redirect rule processed. Thank you again.
perry
May 15, 2020, 12:52am
8
yeah! go team! woooo. you’re welcome! enjoy your new site
1 Like