Page Not Found when using home link or details page link

Hello,

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!

*site: rad-figolla-82ec83

I have checked to make sure that the downloaded deploy file does contain the index.html file.

The build settings do have a publish directory name.

I tried posting pictures to verify, but was blocked from doing so.

Thanks!

Hi @blogfreerecipe :wave:t6: ,

Welcome to the forums. :wave:t6: Can you confirm if you are specifying in the deploy settings which folder to publish?

If your project has a build which generates the site to publish, you’ll need to tell Netlify where to find that directory.

Perhaps you can share a screenshot of what your deploy settings look like?

Sure thing, and thank you for your help!

Hmm, weird and you set your index.html? Can you share your repo as well please?

It won’t let me (as a new user) upload the zip file, but here is a screen shot to verify the html file is there:

@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:

Thank you! That fixed it for me and yay :slight_smile:

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. :blush:

Thank you both! I really appreciate it :slight_smile:

1 Like