How to Permanent Fix 404 Errors in WordPress Site

From Wikipedia

The 404 or Not Found error message is a HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested.

The web site hosting server will typically generate “404 – Not Found” web page, when a user attempts to follow a broken or dead link, hence the 404 error is one of the most recognizable errors users can find on the web

Two advantages we get when we are using this method 

  • Search Engine Ranking will not be affected in any way, as we are using 301 Permanent Redirection here
  • The above trick will actually remove ALL exiting 404 Not Found Errors from Google Webmasters Tools and Bing Webmasters

Login to your WordPress Dashboard and go to Appearance > Editor.

Click 404 Template (404.php) to open it in Editor Window

Delete all code in 404.php file and enter following lines of code in it: 

<?php   header(“Status: 301 Moved Permanently”);

   header(“Location:http://www.yourwebsite.com/”);

?>

Hit the Update File Button

If the file does not exist than create 404 Template file or 404.php. If it does replace it with the following code & click save

<?php   header(“Status: 301 Moved Permanently”);

   header(“Location:http://www.yourwebsite.com/”);

?>

Upload this new 404.php to theme directory. Now when a user hits a 404 page will be redirected to the homepage

Note: “YOURPAGEURL” with your page URL. Make sure you leave the open & close quotes.

2 Comments How to Permanent Fix 404 Errors in WordPress Site

  1. Antonio

    Good day! Do you use Twitter? I’d like to follow you if that would be ok. I’m absolutely enjoying your blog and look forward to
    new updates.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *