There is a React project that uses BrowserHistory and is placed on the Apache server. The project homepage is localhost:8081/home.
After I enter the homepage, I can jump to other subpages (subroutes), such as: localhost:8081/product
But the browser cannot access localhost:8081/product directly because the Apache server will parse this path
I can only access localhost:8081/#/product.
Is there any way to access it directly?
習慣沉默2017-06-05 11:09:46
Forward all requests to index.html
Configure .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>