Dave

Avoiding 404 Errors using 301 Redirects

 
By Dave in Search Engine Optimization
October 3rd, 2007




404 ErrorOne of the simplest things most webmasters and novice SEO’s aren’t aware of is that search engine bots don’t like (Page not Found) . if you’re using the Google Webmaster Tools, you might see 404 errors for pages that don’t exist on your site. This can happen for a variety of reasons including somebody linking to you incorrectly or if you bought a domain that had been previously owned and the former owner had links going into pages that no longer exist on your site. Regardless of the how’s or why’s here’s a quick and simple remedy to redirect all of your error pages to a desired landing page and not suffer any search engine indexing consequences. It can also help you retain any existing backlinks that are incorrectly linked.

First, you will need to create a custom 404 error page and tell your website that it exists. To do this you will need to edit your .htaccess file and insert the following line of code:

ErrorDocument 404 /404.php

This will redirect all 404 errors to a page in your website root directory called “404.php”. You can name it anything you want but *do not* just simply point it at an existing page such as your index.html or index.php file. The reason why is that it will be seen as “duplicate content” if you do not redirect it properly. Once you have that done, you will need to create your 404.php error file and insert the following code:

<?php
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.mysite.com/mypage.php”);
exit();
?>

You can redirect the errors to any page you want and using the “” will assure you will not be subject to duplicate content penalties. This simple solution is one of the first things I do when I bring up a new site. I highly recommend all webmasters learn to use this trick and enjoy !!



Create iPhone Apps in Minutes.


Comments are closed.

Categories
Archives