Winston
Winston

Reputation: 1428

Deployed Netlify page shows 404 page before displaying the actual content

First of all, I would like to create a page that takes the URL parameter (e.g. /test/hell, which test is the page and hell is the parameter).

Therefore I created a page that takes the parameter and shows it on the title (example, with the added page link at the bottom), based on the Gatsby getting started project. It seems working.

But when I open the full URL on the browser (link), it first pops up the 404 pages and then flashback to the correct content (please refresh the page to see the 404 pages). The 404 page is not what I expected so I am not sure if how to get this fixed. Also, this problem is not being observed when I run Netlify/Gatsby locally. Here is the 404 page during webpage refresh:

Deployed site with refresh

This is the added code and this is the only commit that I made. I am not sure how to get rid of the 404 pages being displayed.

Thanks for the help.

Upvotes: 3

Views: 759

Answers (2)

Collins Akinbami
Collins Akinbami

Reputation: 11

I solved the problem by adding a trailing slash to my link URL: From: Link to="/contact" To: Link to="/contact/"

Upvotes: 1

Winston
Winston

Reputation: 1428

I believe the problem could be solved by setting up the _redirects file, required by Netlify, and the plugin gatsby-plugin-netlify setup the _redirects file during build time.

Upvotes: 3

Related Questions