0

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.

user3504982
  • 68
  • 1
  • 6

1 Answers1

1

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.

Yaro
  • 58
  • 1
  • 5