DEV Community

Thiago
Thiago

Posted on

SPA application error 404 on refresh

If you deploy your SPA application on a server as Godaddy or other service and try to access a url diferent from root folder as /about and has an error 404 you can try to solve your problem following this documentation from react:
https://create-react-app.dev/docs/deployment/

But the fast answer for your question is to create a .htaccess file on your server and past the following code:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]

Top comments (0)