Support Forums

'Page Not Found' After Deployment

I have tried the steps here: [Support Guide] I’ve deployed my site but I still see "Page not found”
and I am still getting a problem.

I’m not even necessarily trying to redirect, but rather the route in general is not working. It works on my local machine fine, but when i deploy i cannot go to the route.

Let me know if you need any other info, thanks!

Hi there, @StwertnikCoding

Thanks for reaching out, and welcome to the Netlify Forums! Can you share your Netlify site as well as a public repo? This will help us look into your specific case a bit more closely. Thank you :slight_smile:

Hi Hilllary! Thanks for reaching out and trying to help.
I did find a fix for this problem, and it seems to be a thing with react and where I was placing my redirects and netlify.toml file
I thought I should share this information in case there is anyone else struggling with this problem using React:

  1. You do not need a redirects file unless you’re redirecting somewhere. I think this one should have been common sense for me but for some reason it just didn’t connect.

  2. You need to add a netlify.toml file to the root of your application, even if the published directory is different.

  3. In react you need to include this code in your ‘netlify.toml’ file:

  from = "/*"
  to = "/index.html"
  status = 200
  1. Push and deploy, and it should be working. At least that’s what worked for me, here’s a stack overflow discussion as well as a youtube tutorial detailing the process:
    Stack Overflow React Routes Netlify

Netlify React ‘Page Not Found’ Solution 2021

Glad to hear everything is working :netliconfetti:

Thanks so much for coming back and sharing this detailed write up! It will definitely be beneficial for future Forums members who encounter something similar.

1 Like

sure thing! thought it could be useful to someone someday :slight_smile:

1 Like