Redirecting a 404

A common question is how to redirect all 404s to another page, typically the home page.

The simple answer to this is: don’t!

The question is based on the mistaken belief that a 404 page is bad and needs fixing.

A 404 is the correct response for a page that doesn’t exist and has never existed.

If you wish to provide more useful information to a viewer then you can modify your 404 page. In WordPress this can be achieved by modifying your theme, or even with another plugin. However, it is important that it remains a 404.

A redirect is the correct response for a page that used to exist at one location and has now moved to another. Most times this needs to be permanent (301), but some times you may want a temporary redirect (307).

If you have a page that no longer exists then you should return a 410 message to indicate that it has gone.

But my SEO will suffer

No, it won’t. Automatically redirecting all 404s to another unrelated page is incorrect. This indicates that the page used to exist and now exists elsewhere. This is probably not what you want.

Redirecting to a page that has no relevance to the original URL also has no purpose and may even be detrimental to your site.

For example, it would be possible to misuse this and make spurious (and potentially harmful) requests to a site. The automatic redirect indicates this request is now valid and lives elsewhere.

Redirection’s 404 log

Redirection provides a log of 404s, and people often interpret this as a todo list.

The 404 log can be used to track down pages that do need to be redirected because the URL has changed.

You can use the ‘group by’ filter to organise the log by the most-requested URLs, and then go through those and see if any need redirecting.

It is not necessary to redirect ‘bots’ – automated requests – and doing so is creating yourself more work, adds overhead to your site, and doesn’t improve anything.

Published
Categorized as Tip