Monday, July 19th, 2010

Using a 302 Redirect in Place of a 404 Error is a Bad Idea


If your site is currently treating unavailable pages (404 errors) like temporary redirects (302 redirects) you may not have any problems with the search engines but your site is losing out on some important advantages of a proper 404 error.

The Way a 404 Normally Works

This is how a 404 normally works on a website when a search engine, let’s use Google, visits a URL (i.e address) on your website that cannot be found that was previously spidered/indexed as functional:

  1. The visit produces a 404 error from the server.
    A 404 error is  provided by your server when an Internet client (i.e. a browser, search engine, etc.) reaches a URL on your site that can not be produced by your server because it is no longer there or it is incorrect.
  2. The first time Google encounters this 404 error, it does not remove your URL but it takes note the page is not available and the broken link/missing address will be mentioned in your Google Webmaster Tools dashboard for you to fix ASAP.
  3. The second time Google encounters the 404 error it is a good bet the page will be removed from its index and the error will remain in your Webmaster Tools dashboard for fixing. Google will continue to find the broken link until it is fixed, at which point any associated rankings you had for this page can work their way back up to where they were.

Using a 302 Redirect Response Instead of a 404 Error Response

Here is the situation: when a search engine visits a URL that no longer exists, your server delivers a 302 redirect response instead of the proper 404 response. The 302 response is essentially this – “this page is being temporarily redirected” to a page you defined (i.e. your home page). As a result, Google does not see the 404 and Google will retain any search rankings the URL may have because it is expecting the old URL to resurface. In theory, that sounds like a good thing because you get to keep your old ranking (temporarily) while Google visitors are redirected seamlessly to your home page (the page you chose to redirect to).

Why Isn’t this a Good Idea?

  1. Visitors end up being rerouted to your home page oblivious to the redirect and end up on a page that may or may not have any relevance to their original search. Not only is this likely to cause an undesirable reaction but it also makes Google look incompetent… something the search engine is not likely to favour you for.
  2. Since a 404 is not triggered, there is no way to determine if pages are broken on your website (unless a custom report has been created).
  3. 302 redirects do not pass PageRank – so unless the original page is restored, much of the benefit from the links to your old content will evaporate with time.
  4. If this practice is utilized site-wide it is conceivable your website rankings would diminish due to the myriad of confusing “temporary” signals provided by your site.

What is the Best Solution?

  1. If you have been using 302 redirects in place of a 404, then I strongly recommend restoring the 404 protocol.
  2. Create a custom error page for 404s which will give visitors that encounter your error page an indication of how to get back on track. Once Google finds the 404 errors on your site they will be reported to you in your Google Webmaster Tools.
  3. Whenever you, as a webmaster, encounter a reported 404 error on your website it is best to quickly 301 (permanently) redirect old URLs to content that is closely relevant to the past content. Not only will this help you to keep visitors to your site happy but 301 redirects will pass forward the critical PageRank (ie. Google credibility) that may have been built on the old URL.

Additional Relevant Content

Here are some tools and articles that are relevant to this article:

14 Responses to “Using a 302 Redirect in Place of a 404 Error is a Bad Idea”

  1. Elizabeth Able

    Good explanation, with links to good references. Thank you.

  2. Ross Dunn

    Thank you for the kind comment Elizabeth! It is appreciated :-)

  3. Mark

    Good advice.

    I would also suggest when you reorganize a site and actually rename pages or folders so the URL changes, a 301 on the old page is the best solution. That is, a page to page map from the old pages to the new. If possible, don’t just dump visitors onto a 404 page. Eliminate confusion, and clicks, whenever you can.

    This can be a lot of work on really large sites but it can pay off. As you mention, the 301 passes the visitor and page rank seamlessly through to the new page … when you have one. You aren’t going to re-create the old page so move visitors and search results to the new location. When the page goes away, definitely use the 404. We rarely use a 302.

  4. Johnnie Eredia

    Not sure if you know this or not butyour website doesnt load properly when using safari. wanted let you know

  5. Ross Dunn

    Thank you Johnnie, I didn’t know that. We are very strict about W3C compliancy (or try to be) so I will look into this. I appreciate your note!

  6. njmehta

    If your site is currently treating unavailable pages (404 errors) like temporary redirects (302 redirects) you may not have any problems with the search engines but your site is losing out on some important advantages of a proper 404 error.

  7. Jason Matthews

    cool info, thanks. Now I just need to search for the instructions on creating a custom 404, which I’m guessing is very close.

  8. zifan

    I have 4.535 error link in google webmaster,but all link is not error.Why,please that because i redirect 404?or else

  9. Neotropic

    Sadly… trying to get 404’s to work properly is a joke of a task to some extent. You add to your .htaccess ‘ErrorDocument 404 /errors.php?code=404’ which does and will give header, 404. But first gives you a 302 redirect to get to the 404 page. Its a damn joke.

  10. Dave

    Exactly what I was looking for. Thanks for the info!

Leave a Reply