Tuesday, June 24, 2025

When refresh the react page getting 404 not found error

 My development team is working on React and Nodejs combination, after deployment the links are working but when we do a refresh on the working page getting "404 not found error"

Solution.

Make sure you have AllowOverride All

In your document root, vi .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>

Now try refresh, it will work.

No comments:

Post a Comment