Reputation: 108
I've tried this
React-Router: No Not Found Route?
at my localhost, it works well. But in the remote server, it doesn’t work. when I put "xxx.xxx.xxx.xxx/Welcome " directly on browser , 404 always comes out.
Upvotes: 0
Views: 116
Reputation: 58
Please, post router code snippet and webserver config. I assume the problem is nginx/apache not serving index.html
properly.
Here i have an example from my working server that serves build version of my react project that uses react-router
server {
...
location / {
root /home/full_project_directory/build;
try_files $uri /index.html =404;
}
...
}
The code above catches any path variables and redirects them to index.html, where react-router is able to handle them.
Upvotes: 1