Not Found error when trying to access subpages directly

Hi,

Something weird’s going on in the production version of my site. When I try to access a subpage directly it gives me a “Not Found” error, but not when I access that page by clicking from the home page.

This error doesn’t happen on my local machine which is why I think it might have something to do with Render. The site is a static react site.

Any idea what’s going on?

Thanks

I think it relates to the client-side routing setting in your frontend service. I use react router direct link not working as a keyword and find this javascript - React-router urls don't work when refreshing or writing manually - Stack Overflow . If you are using react-router, hopefully this article will be helpful.

Thanks Hao Ji! You’ll notice that the answer you point to says it’s a server-side issue. I’ve actually followed these instructions to fix a similar error I had on a webpack dev server today. By default the dev server only listens to /, so the same problem happens when you try to access subroutes directly.
I think the error and fix might be similar, however since this is a static site and render controls the server I don’t know how to proceed.

Ended up finding the solution in the docs: Deploy a Create React App Static Site | Render
I hadn’t looked because I’m not using create-react-app, but it’s the same idea.

1 Like