I\'m using React-router and it works fine while I\'m clicking on link buttons, but when I refresh my webpage it does not load what I want.
For instance, I am in
I used create-react-app to make a website just now and had the same issue presented here. I use BrowserRouting
from the react-router-dom
package. I am running on a Nginx server and what solved it for me was adding the following to /etc/nginx/yourconfig.conf
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.html break;
}
}
Which corresponds to adding the following to the .htaccess
in case you are running Appache
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
This also seems to be the solution suggested by Facebook themselves and can be found here