How to Redirect Your 404 Errors to Your Home Page

Table of Contents

Last month I showed you how you can redirect your old WordPress permalink structure to /%postname%/. Today I’d like to show you a much simpler snippet of code that helps redirect all 404 not found error messages to your home page.

This can be useful if you have a small website with very few pages. For example, say you have a small landing page website that you are using to collect leads for your email list. You may create dozens of landing pages. Rather than show a 404 error message to a visitor, you would convert higher if you just redirected the visitor to the home page.

To redirect all 404 not found errors to the home page, you all you have to do is add this to your .htaccess file:

ErrorDocument 404 /

The same code can be adapted to direct 404 errors to any page you want. For example,

ErrorDocument 404 /404-error-page.html

Or

ErrorDocument 404 /404

If you’ve moved websites and haven’t redirected all url’s correctly, redirecting errors to your home page might be something you will consider. A good quality 404 that explains that the user has come across a page that is no longer available is much better though as it explains to the visitor why they aren’t seeing the page they thought they would.

If you are using WordPress, you may have a 404 solution built into your theme already. In WordPress, any theme that has a 404.php template will redirect all errors to www.website.com/404 automatically.

99% of the time you should be showing the 404 error page for errors however if you do need to redirect all errors to the home page, you may find the above code useful.

Thanks,

Kevin

6 thoughts on “How to Redirect Your 404 Errors to Your Home Page”

  1. Very informative post, Kevin. I loved especially how you covered the way of redirecting 404 not found pages. I never tried this method before. But Thanks for explaining me this method.

  2. Indeed a Great post about 404 redirection.

    It is said that 404 not found pages or broken pages aren’t good for any blog because It gives bad user experience and It also affects badly in search engine rankings.

    Search engine like Google never wants to redirect their users to a page which shows not found errors. Right?

    So It is must to redirect these 404 pages to either another relevant page or to homepage.

    I can remember when I started my 1st blog then I didn’t have any idea that on which niche I should write. So I used to write on different different topics and later deleted those articles when move to another niche.

    In this way, I created so many 404 not found pages in my blog and one day, I realized that Webmaster tools is showing so many not found errors.

    When I saw that, I scared because I didn’t knew about these pages at that time. Then I did research and fixed those pages.

    Thanks for sharing such a wonderful tutorial. :D

  3. I wouldn’t go as far as saying that Google hate’s 404 pages. Every website will have 404 errors. It’s impossible not to as other people will occasionally link to your website using the wrong URL. Even a misplaced hyphen in an incoming link can create a 404 error.

    You should definitely address them whenever you can. If possible, redirect visitors to the correct page.

    A well written 404 page can go a long way to retaining the visitor and stopping them from immediately clicking the back button.

    Kevin

  4. I can’t deny that you haven’t written informative article.

    It is true that your article is very much helpful and informative.

    As I had started my blog few months ago so I haven’t enough information about 404 error pages and that’s why, I had so many 404 errors on my blog and after reading this article, I get to know that how to deal with these not found errors.

    If I am right then 404 pages are those where we don’t find any content except a 404 error message and It occurs If any writer deleted the existing content and the URL of that content remain indexed in search results.

    I also heard that Google don’t like these pages so every webmaster should check out their website regularly for these errors to keep their website SEO friendly.

    Thanks for sharing this article with us because It taught me that how I can handle these pages and keep my site at safer side. :D

  5. Hi David.

    Glad you found it useful.

    Yes a 404 page is essentially a URL that used to have content but no longer does. It can also be a page that never had content. For example, if someone links to this article using the wrong URL, a 404 error would be returned.

    Be sure to drop by Rise Forums if you are unsure about any of this :)

    Kevin

  6. Hi Kevin

    I don’t know much about 404 error pages because I had started my blogging career recently.

    But somewhere I read that If any blogger or writer deleted the existing web page then the URL of that web page becomes 404 URL and that page becomes 404 page.

    It is also said that Google don’t like 404 page so I checked my site whether I had any 404 page or not then I found few of the 404 error pages on my site also.

    But Now after reading this post, I can easily handle these pages.

    Thanks for sharing such a helpful post with us. :D

Leave a comment

Share This