I made a static website application in React. localhost is working. but when I upload it to the server, I get a page not found error when I refresh the page on pages other than the home page. What is the solution?
Create .htaccess file on the Server and past below code in the file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>