Your site should be free of broken links and configured to signal broken links to crawlers using a 404 response status code.

No matter how beautiful and useful your custom 404 page, you probably don’t want it to appear in Google search results. In order to prevent 404 pages from being indexed by Google and other search engines, make sure your webserver returns an actual 404 HTTP status code when a missing page is requested.

Google, "Create custom 404 pages"

Use 404 code for broken URLs

When a URL is requested that doesn’t exist, return a 404 HTTP status code so search bots know the link is broken. If the URL hasn’t been indexed yet, this stops search bots indexing the page which is what you want if the page really doesn’t exist. A working page that’s been indexed already that begins returning a 404 code as opposed to say a 200 success code will eventually be removed from search results so make sure the 404 code is only returned for broken URLs. The 404 code is also important if you want to use tools that scan your site for broken links as there’s no other way for a machine to warn you that broken links exist. For users, when returning a 404 error you should make sure to display a human friendly “not found” page that helps users find what they were looking for. Test your 404 setup by 1) visiting a URL that shouldn’t exist like /page-not-found-test and 2) verifying the URL returns a 404 status code. If your setup is broken, the solution is often highly specific to the web framework and web server combination you’re using as either or both could be misconfigured. Try searching for a tutorial on setting 404 pages for your particular setup and then investigate how your configuration differs.

All internal links on your website should be valid and working. Broken hyperlinks between pages can prevent search engines from finding parts of your site and stops your pages from passing on the boost in search rank that come from page links. Users will also become frustrated if they can’t view content because of broken URLs.

All links to external websites should be valid and working. Links to sites you don’t control should be regularly monitored and updated as links that used to work may break in the future when external pages are deleted or moved. Broken links can signal to search engines that your site is poor quality and will frustrate users.

Avoid broken page resources

Links to page resources such as images, CSS and JavaScript should all be working. Page resources that don’t load can cause content to not be shown, displayed incorrectly and break interactive content. These problems will give a poor user experience and could impact your search ranking.

More articles in this series

➜  This article is from our comprehensive SEO Best Practices guide.

➜  Next article in this series: Robots.txt

➜  Previous article in this series: Code validation