On Apache server, React Application works fine, but if you refresh a page, it shows 404 error. This is because the application use BrowserRouter. To fix the error, create a .htaccess file with following content
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.html [QSA,L]
Put this on the folder where your application index.html is or in Apache Virtual Host entry.
See htaccess
Leave a Reply