I am getting a Page Not Found error when using a link to the home page or a details page. If you refresh from the home page, the site works as expected after that. But from the details page, you can’t refresh to get any content. Please help!
@blogfreerecipe This is occurring because your site is a react based SPA (Single Page Application).
When you visit the site via the root / it is automatically loading the index.html which is your application, and then when you visit other pages you never actually leave the index.html page (it just looks like you do).
So /recipeDetails/110133d3dd574821a9ab17b9d160d06d loads in additional data and simulates a browser page change.
However when you make a fresh request for example by going to one of those sub pages directly or hitting refresh while on them (e.g. https://www.blogfreerecipe.com/recipeDetails/110133d3dd574821a9ab17b9d160d06d), the web server is being requested to serve that file… but the file doesn’t actually exist… hence the 404 error.
The way around this is via redirects, you’ll want to have a _redirects file in your deploy folder that contains:
/* /index.html 200
You can see it referenced in the documentation here:
Hi @blogfreerecipe glad it worked for you! Thanks @nathanmartin for engaging with our community members to help them get unstuck. We appreciate you and your efforts.
I’m experiencing the issue with the details page link. When I try to use it, I’m not able to access the page details. This seems to only work if I’ve already browsed to the page, which is not ideal if I want to share a link. The redirect doesn’t seem to work unless I’ve already follow the links on my site to the detail page. Any suggestions on how I can fix this issue?"