I created a website using React and Vite. On localhost, it navigates to different pages without any problems. However, when I deploy it to Vercel or any other hosting provider, I get a 404 error when I try to navigate to different pages. Why is this happening?
Steps to reproduce:
Create a new React project with Vite. Install React Router. Add a few routes to your index.js file. Build your website for production. Deploy your website to Vercel or any other hosting provider. Try to navigate to different pages on your website. Expected behavior:
I should be able to navigate to different pages on my website without getting a 404 error.
Actual behavior:
I get a 404 error when I try to navigate to different pages on my website.
You can check that at https://theneonworkshop.com/ going to different pages and if it works for you then refresh the page.