Preventing 404 Not Found Errors, Part 4

Over the past few weeks we've been discussing how you prevent 404 errors on your website when removing pages from your website. In parts one, two, and three we looked at how you know which pages could create a costly 404 if they were removed from your website.

By the end of part three, we had a clear indication of which pages, if removed, could become costly 404s. Now, we need to remove those pages while at the same time preventing the 404 error from occurring.

Preventing 404s: Redirecting

The most effective way to prevent 404 errors when removing pages from your website is by adding redirects. Redirects act like a forwarding address from the post office.

To use our example from the previous parts of this post, let's say you were going to remove blue-widget-overview.html. To prevent that URL from becoming a 404 error, you would want to redirect blue-widget-overview.html to another page on your site. That way, when somebody attempts to access blue-widget-overview.html that person is instead redirected to a different page on your website.

Determining The Redirect

The first step in creating a redirect is to determine where you want visitors to go instead of the page you are removing.

In the example, if you are removing the blue-widget-overview.html page, then it might make sense to redirect that URL to red-widget-overview.html. That way, after you remove the blue-widget-overview.html page, visitors who come looking for that page will instead find the red-widget-overview.html page.

While this may not be precisely what they were looking for, it is closer to what they wanted. Because of that, people are less likely to leave your website (like they would if blue-widget-overview.html returned a 404 error).

Implementing The Redirect

Once you decide where to redirect the pages you are removing, you can implement the redirect. Two common ways to implement a redirect are via an htaccess file or via a web.config file. get code samples and learn more about those approaches to adding redirects.

Preventing 404s: Removing Links To Those Pages On Your Site

Along with adding the redirects to prevent 404 errors when you remove pages, you will want to remove links to the pages you are removing from your website.

Why? This serves two purposes:

  1. First, removing the links will keep people from attempting to access a page that no longer exists. This avoids frustrated visitors who can't find what they were looking for your site.
  2. Second, removing links acts as a clear signal to search engines that you intended to remove this page from your website. If you remove the page, add the redirect, but keep links on your site referencing the page, you are sending mixed signals.

How To Implement Redirects

To identify all the links to a certain page, you can, of course, search your website's code for each link. We'll leave that to you and your developer(s) to determine how exactly to do that on your site. However, here are a few quick tips on identify the sources leading to those pages:

  1. You can use a tool like Open Site Explorer to find the pages linking to the page you are about to remove. Simply type in the URL for the page you are about to remove, and you will get a list of the pages linking to the page you are about to remove. Using Open Site Explorer, you can filter this to only show pages on your site.

    Open Site Explorer To Find Links
    Use Open Site Explorer To Find Links
  2. You can also look at Google Analytics data to find which pages on your site send the most visitors to the page you are planning on removing. To get to this data, open the Pages report in Google Analytics. Go to the page you want to remove and click the URL to get the details about that page. On the details report, open up the "navigation summary" tab. The data in the "previous page path" column are the top sources on your site linking to this page.

    Google Analytics Previous Page Path
    Google Analytics Navigation Summary
  3. Don't forget about your HTML and XML sitemaps. These files usually contain the URL for almost every page (if not every page on your site). While most sites automatically generate the XML and HTML sitemaps, not every site does. If your XML sitemap or HTML sitemap isn't automatically generated, please make sure you remove the pages from the XML sitemap when you remove them from your website. That way you quit telling search robots and people about the pages you have removed from your website.

Preventing 404s: Monitoring

The final step in preventing the 404 is to monitor your website (with, say, a tool like SpringTrax) to make sure that your redirects are working properly. It is possible that you will forget to add in a redirect for one of the pages you remove, especially if you remove lots of pages at once.

On occasion, we have also seen websites that accidentally remove redirects and, by doing so, cause several visitors to reach 404 errors. We don't want that to happen to you on your site.

Using a tool like SpringTrax to monitor visits to your 404 pages will instantly alert you if that occurs (as well as alerting you to every other 404 your visitors encounter).

Recapping All The Steps

We hope this four part series helps you avoid 404 errors when you remove pages from your website. To recap, all the steps, in order, are:

  1. Review the visits to the pages you want to remove.
  2. Review the links to the pages you want to remove.
  3. Use that data to determine which pages could cause a costly 404 when removed.
  4. Redirect the removed pages to another page on your website.
  5. Remove links from your website referencing the removed page.
  6. Use SpringTrax to monitor your website to make sure those removed pages (or other pages) don't cause 404 errors on your site.

As always, please let us know if you have any questions. You can contact us on Twitter, via email, or by leaving a comment below.


Share This Post

Add Comments

comments powered by Disqus

Are You Ready To Quit Losing Customers?

Sign Up Today To Find & Fix Every 404 Error On Your Website.

Sign Up Today

Starts at $19.99/month. 30 day money back guarantee. Cancel at any time.