Assuming that you have a web-app with domain example.com
, routing implemented using React Router. Website is hosted on Netlify
example.com
, page loads normallyexample.com/route-name
, page is not found even though there is such Route
set upReact Router handles routing on the client side (browser) so when you visit non-root page (e.g.
https://yoursite.netlify.com/else
), Netlify (server-side) does not know how to handle the route. (As your routes are set up in the root level).
To fix the issue, we need to create a file named _redirects
to the root of your site with following content.
1
/* /index.html 200