React Router redirections not working! Just goes to Netlify 404

Website: https://geventas.com

I’m using React Router for handling address bar locations.

In the development build, it works pretty well. In Netlify production, this occurs:

  • When not logged in, a known url => Netlify 404
  • When not logged in, an unknown url => Netlify 404
  • When logged in, a known url => Redirection to the url
  • When logged in, an unknown url => Netlify 404

The expected behaviour is:

  • When not logged in, a known url => Login redirection
  • When not logged in, an unknown url => Login redirection
  • When logged in, a known url => Redirection to the url
  • When logged in, an unknown url => Custom 404

Hi, @angel-luis, my best guess is that the client side routing doesn’t work because the following redirect rule is required:

/*    /index.html   200

Because the rule doesn’t exist, the client side routing doesn’t trigger. There is more information about making this rule here:

If adding that rule doesn’t resolve the issue and/or if there are other questions, please let us know.

Hi, still not working.

I think I’ve configured correctly the redirection. In the project root, I’ve created a file called “_redirects” and I’ve added that line.

Ok the problem was that I was putting the “_redirects” file on root directory instead of public. :sweat_smile:

1 Like

classic! glad its working now :smiley: