Con-Shoc / auto

1 stars 0 forks source link

SEO - No 404 Page #12

Closed Con-Shoc closed 6 years ago

Con-Shoc commented 6 years ago

Issue (Current Behaviour There is no existing 404 page.

When a page or URL doesn't exist, the site automatically redirects back to the homepage.

Expected Behaviour When a user lands on a URL or page that doesn't exist, a custom 404 page should be shown to the user. The server should also emit a 404 Response Code on the server when this happens.

Solution Within React Router, you can set a page to redirect to a 404 page if it doesn't match anything.

A guide on this can be found here: https://tylermcginnis.com/react-router-handling-404-pages/

Make sure that this 404 page has a <meta name="robots" content="noindex"> in the section. That can be completed with React Helmet.