简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM