Hosting Tutorial & Guide

How to Track and Redirect 404 Pages Easily in WordPress?

updated on Mar 18, 2015
How to Track and Redirect 404 Pages Easily in WordPress? Error 404 pages can be a common headache for most website owners, and there are many reasons to cause this embarrassing issue. In most cases, a 404 error page will be showed to visitors once you delete a post/page without redirecting it. Also, if you change the structure of permalink during your website transfer, the old permalink would be 404 error page.

The "404 Page Not Found" errors will spoil your website and hamper your search engine rankings by frustrating and annoying audiences. At this place, we would like to give an outline of how to track and redirect the mistaken 404 errors on your WordPress site. Note that, we will cover both manual and automatic methods in the following parts.

How to Track 404 Errors with Google Webmaster Tools?

Before starting out, you might like to see if your website has any error 404 pages firstly. Here, it is recommendable to use the "Crawl Errors" functionality provided by Google Webmaster Tools to track the 404 errors. As you can see, any pages that couldn't be indexed will be highlighted on this "Crawl Errors" page.

404 Redirect - Crawl Errors Page

How to Redirect 404 Page Errors to Your Homepage?

Being faced with the 404 pages, you can choose to create custom redirects in a WordPress site. That is to say, you can simply re-direct the 404 page to your site home page by customizing your 404.php file. To be precise, you are expected to access your WordPress themes 404.php file by following the root given below. If you don't have this 404.php file, you will need to create a new .php file in advance.

404 Redirect - Redirect 404 Page Errors to Your Homepage

Once entered, you shall remove all lines of code within this 404.php file, and copy the below code to this file. Once you "Save" the 404.php file, all the 404 error pages will be redirected to the homepage of your WordPress site.

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>

How to Use Redirection to Track and Redirect 404 Pages?

If you are not sure about dealing with theme's files, then the "Redirection" plugin will be a perfect solution for you. Generally speaking, this hassle-free "Redirection" plugin empowers you to keep track of 404 errors, manage 301 redirections and wipe out any loose ends on your website. The highlight of this WP plugin is that you don't need to have knowledge of Apache .htaccess files in order to redirect broken URL to the new one. Note that, the "Redirection" plugin is always available for free download through the following address.

404 Redirect - About Redirection Plugin

Having given a tough idea about this "Redirection" plugin, we would like to show you how to use it to track and redirect your 404 page errors. Now, scroll down and get to know the detailed steps.

Step 1 – Install & Activate the Redirection Plugin
At the very beginning, you shall "Install" and "Activate" the "Redirection" in WordPress. As is mentioned in this installation tutorial, there are a total of three different ways to achieve this goal. Once done, you will select out this newly-enabled plugin inside the "Installed Plugins" tab.

404 Redirect - Install & Activate the Redirection Plugin

Step 2 – Add New Redirection
Next, go to "Tools" > "Redirection" and you will be prompted to enter the "Source (old) URL" and "Target (new) URL" as below. In the meantime, there are a few options in the drop-down "Match" list, including "URL only", "URL and referrer", "URL and user agent" and "URL and login status." If you want to redirect visitors using your old URLs to the new location, you can simply choose the "URL and referrer" option.

404 Redirect - Add New Redirection

In most cases, the "Action" should be "Redirect to URL." If you've done with these configurations, you will have to press the "Add Redirection" button and check whether the new URL works fine as expected.

Step 3 – Make Advanced Configurations
On the same "Redirection" page, you can track 404s under this "Log" tab. Usually, you will be presented with a full list of 404 logs that your website may have. As a matter of course, you can choose to delete all logs or export them to CSV based on personal references.

404 Redirect - Edit Log Tab

Apart from that, this "Redirection" plugin allows you to decide the frequency to "Redirect Logs" and "404 Logs." By the way, it also gives you the "Options" to import redirections from a CSV file or an existing .htaccess file.

404 Redirect - Edit Options Tab