Every website owner is facing the problem of 404s error. In this wordpress tutorial we learn how to redirect 404.php page to home page. Every web platform like WordPress allows you to create a page for handling 404 errors. Having a 404.php file in your theme file is the best programming practice in web development. If you want to redirect every 404 URL to homepage, this tutorial will surely help you.

You May Also Like:

Here We Start a usefull wordpress tutorial

Method 1:

Open your 404.php file paste the following code in the file completely. Note, do not include get_header() or wp_footer() or other things if you are editing the page.



<meta HTTP-EQUIV="REFRESH" content="0; url=<?php bloginfo('url'); ?>">



Method 2:

header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));

Note: This tutorial is for the users who wants to redirect all 404 errors to the homepage. In other case, you can
use any WordPress plugin like WP-301 for custom redirect.

About The Author

Related Posts

One Response

  1. David

    Hi Mani

    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. 😀


Leave a Reply

Your email address will not be published.