React-router redirects not working after adding _redirects and netlify.toml

Site Name:
Issue: I have a react app, built using Vite, with react-router for routing. Since switching from CRA to Vite, redirects have not been working. I get a Page not found if I attempt to directly navigate to any page except / or /index.html.

I’ve added a netlify.toml file with the following:

  from = "/*"
  to = "/index.html"
  status = 200

I’ve also added a _redirects file with the following:

/* /index.html 200

I’ve downloaded the site, and confirmed that the files are showing up where I’d expect them to:

I’m not sure where to go from here…thoughts?

Hi @claysonIO, thanks for the post and welcome.
If possible can you share a repository of the site you are trying to deploy for me to help with the debugging?


Hi Clarnx,

While putting together a demo repository, I discovered that the problem seems to be limited to this specific site on Netlify. I created a new site with my original repo and it’s working as expected.

So no idea what got out of whack, but recreating the project in netlify seems to be all that it needed.



Hello @claysonIO, thanks for sharing how you fixed the problem.