301 Redirects - SEO Fever logo

SEO Fever
Search Engine Optimization
for the World Wide
Web

Everything you've always wanted to know about
search engine optimization, but were afraid to ask.

 
 
Home >> SEO Knowledge Base >> 301 Redirects
 

SEO Fever

SEO News

SEO Tools

 

 

301 Redirects

Why use a 301 redirect?

There are three main reasons for using a 301 redirect. Redirecting your hostless (non-www) domain to your "www" domain, redirecting your old site to your new one, whether is be on the same domain or not, and for setting up parking domains for your site.

For example, Imagine you currently have a web site that is ranked in the top 10 results in Google. You are enjoying the traffic that the high rank is bringing you, but now you want to redesign your site to keep up with competitor technology.

Say you choose to go from using standard .html to .php for your website. If you just change your website without using a 301 redirect, then all your rankings from your .html site will be lost as search engines will see them as different sites.

A 301 Redirect will tell any search engines that the page they are currently looking for has permanantly moved. So the search engines will carry over your page rank to the new site.

How do I do a 301 Redirect?

There are many different ways to implement a 301 rediect on your site, using many different technologies to do it.

301 Redirect using IIS

These instructions will redirect your whole site to a new domain

  • In internet services manager, right click on the file or folder you wish to redirect
  • Select the radio button titled "a redirection to a URL".
  • Enter the redirection page
  • Check "The exact url entered above" and the "A permanent redirection for this resource"
  • Click on 'Apply'

301 Redirect using Apache

To redirect your whole site to a new domain put the following code in your .htaccess file

Redirect 301 / http://www.yourdomain.com

301 Redirect using Apache's Mod_Rewite

Add this code to your .htaccess file and it will redirect your whole site to a new domain.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain\.com RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L]

Redirect using PHP

If you don’t have access to your server settings or .htaccess file, then this is the code to use. Add it to index.php with nothing else in the file and you will do a 301 redirect to a new domain.

<?
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://www.new-url.com");
exit();
?>

Redirect in ColdFusion

Again, use this code if you don’t have access to your server settings or .htaccess files. Add this code to a .cfm file or a file that is getting parsed by ColdFusion and it will result in a 301 redirect to a new domain.

<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="http://www.new-url.com">

Which Redirect should I use?

You should analyse exactly what you need your redirect to do. Do you need the redirect to move your site to a new domain? Do you need it to change the extensions of your site?

If you need to redirect your whole site to a new domain, then best practice would be to use either the ISS or Apache redirects depending on what web server software you are using.

If you have just updated your website and changed the file extensions, and you have kept the same filenames throughout your whole site (e.g. index.html to index.php, sitemap.html to sitemap.php etc.) then you should use the code below in your .htaccess file.

RedirectMatch 301 (.*)\.html$ http://www.newdomain.com$1.php

26th June 2006

   
SEO - Blue-gray spacer
 
SEO Fever

Home | KnowledgeBase | SEO Glossary | Site Map

For more information please contact us.