menu

Questions & Answers

When react app reload/refresh then it's says 404 not fount

I'm facing an issue that is when I reload/refresh my app then it says 404 error (remember it shows only on production) not development mode. enter image description here I tried it on

Vite and ReactJs
```.

Resolve the react 404 error.
Comments:
2023-01-23 23:25:06
If it happens only on production, then the "probable" reason could be that the app is not successfully deployed or the load balancer / server routing config is not configured to serve your app on the /dashboards/user
Answers(1) :

This will vary depending on the hosting service. Nginx or Apache must be configured. If you have access to the configuration your domain server, you can add your domain config file below codes;

location / {
 try_files $uri /index.html;
}

if you are use Netlify add the netlify.toml and paste the below codes.

[[redirects]]
  from = "/*"
  to = "/"
  status = 200