How to Redirect 404 Error in WordPress – Easy Tutorial

Learn how to Redirect 404 Error in WordPress to your Home Page or any other required Custom landing Pages using any of these following methods given below. When visitors clicks on some link on your website and find a 404 Error it will drive them away from your website or blog. I hope that the wordpress theme that you are using already has a 404 error page named as 404.php. You can create custom re-directs in your wordpress blog or website using the methods given below.


Redirect 404 to your Homepage in WordPress:

  • Open your WordPress Themes 404.php file, found in the themes Directory, i.e at [ Wp-Content->Themes->Theme_Name->404.php ]. 
  • After opening this file, delete all the code you find inside it.
  • After removing all lines of code inside the 404.php file, copy the code given below and paste it into this file.
  • Save the file. Now all 404 Errors will be redirected to your wordpress blog’s home page. 

  • If your wordpress theme does not have a 404.php file, then just create a new file. 
  • Name this new file as 404.php . 
  • Copy the Code given above in to this newly created file.
  • Save it in the required Theme Directory. 

Use 404 Error Redirect WordPress Plugin:

If you are not too sure about playing with you Code, then you can use the Redirection wordpress plugin. This is a free to use wordpress plugin.

  • Install the Redirection WordPress Plugin on your wordpress blog.
  • After you have installed this wordpress plugin, go to the settings page on the left side of your wordpress admin dashboard.
  • Change and customize the setting according to your requirement.
  • After Changing the settings save the options. Now, your redirection will work as required.

Note that this plugin can also be used to keep track of 404 errors (page not found error), and also to manage 301 re-directions (permanent redirection).

WordPress 404 redirect using htaccess:

You can Redirect 404 errors using the methods given above, by changing a part of the code in WordPress. But if you want to generate a re-redirect from the server itself, then you can follow the simple steps given below.

  1. Log in to your web server.
  2. Copy the .htaccess file found on Servers Root directory.
  3. Open the .htaccess file on your favorite text editor.
  4. Copy the any one the lines of code given below in to this file.
  5. Save and Upload this file on to the server.
  6. Now all 404 errors will be redirected to the required pages.

Just add the following line to your .htaccess file :

You can place this 404 error template where ever you want in your web server. In the code given below, the term error_messages is a directory, and 404.php is a file inside that directory.

I hope this tutorial was useful for you to redirect wordpress page to another url or to your home page as and where required. If you have any queries then please comment below.

About Mazhar

Computer Science Engineer, Cloud Architect, Programmer, Currently Employed as the Head of E-Commerce at one of India's largest Men's Apparel Brand...
Hey, lets Connect on Facebook | Twitter | Google+ | LinkedIn | RSS


  1. Rafi says:

    But how to redirect in blogger ?

Speak Your Mind