Chette Soriano
home . about . contact me
Chette Soriano *
chette home
Search Engine Friendly Redirection | Print |  E-mail
Written by Chette Soriano   
Saturday, 06 January 2007
Image

"Website redirection" means that when a user goes to one of your web pages, you automatically lead him to another site (or page). This is particularly useful if you have changed your domain name or site structure.

In chette.com, you would notice that I use this. If you go to the URL www.chette.com, you are actually redirected to www.chette.com/main. Main is a folder in my public html. I put my content files in subfolders in order to keep my public_html directory neat, and to enable me to test an upgraded CMS before making it accessible to the public.

The old-school way of redirection was thru the infamous meta refresh tag. However, websites which contain this tag are already being tagged as spam by search engines.

A better alternative is to use a 301 or 302 redirect. These are called response codes. A more technical definition is available, but in a nutshell, if you use a 301 or a 302 redirect, you are just automatically directing your visitors to your new URL.

301 returns a user-agent response that your website has moved permanently to a new location. A 302, on the other hand, returns that your website has only moved temporarily.

What to use

There are a lot of arguments on 301 vs. 302. Some would favor one over the other, claiming that 302 should be strictly used for temporary locations, that 301 is preferred by search engines, etc. etc. However, from my own experience, it is most effective to use both.

Let's say you have gotten a new domain name or URL.

First, submit this to Google's index, but make sure that you retain your old domain (or URL) for the time being.

Then, put a 302 on your old domain name. That way, your old domain name and its rankings in Google are retained. Additionally, whenever someone clicks on a link which still has your old domain, because your server has a 302, it will automatically redirect them to your new domain name.

Wait a few months for your new domain name to "age" in Google. Aging is very important, and it usually takes 2 to 6 months, at the very least.

When your new site has aged satisfactorily, change your 302 redirects to a 301. This will transfer the page ranking of your old site to your new one in Google.

How to make the redirection

The most robust way of doing the redirection is thru .htaccess.

  1. Create a text file called .htaccess in your local PC.
  2. Put the following in this text file:

    Redirect 302 / http://www.newdomain.com/

    Replace www.newdomain.com with your new domain name.
  3. Save your text file.
  4. Upload this file in your old domain name's public_html.

If you only want to redirect users to another directory, try this more convenient method thru PHP:

  1. Create a file with the same filename as your old web page file (index.php, default.php, etc.)
  2. Enter the following lines:

    <?
    header("Status: 301 Found");
    header("Location: main");
    ?>

  3. Upload this file in your directory.
Trackback(0)
Comments (6)add comment

toto_ja said:

wow! kailangan pala akong mag double time nito sa pag aaral.

thanks ate, inspiring post!
January 08, 2007

smiley15 said:

thanks for writing a very easy to read tutorial. i like how you outlined and presented it.
January 10, 2007

darth said:

Chette, I was wondering why you dont seem to write about SEO a lot. You have nice google positions and seem to know something. Could you share some of your tips.
January 18, 2007

Laura said:

This is another useful article for me. Ive bookmarked it for future reference. Thanks for the favicon tutorial too!
January 24, 2007

chette said:

Thanks guys. I got a lot of htaccess questions in my email. I'll try to answer them all in future posts.
January 26, 2007

NicoY said:

HoW to redirect to subdomain to subdirectory using htaccess?
January 28, 2007

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy
 
< Prev   Next >
* *
Main Menu
chette's articles
photo gallery
photos on the go
.........................
bookmarks
search
about
faq
contact me
Subscribe
About Me
chette

Name: Chette Soriano
Location: Pasig City, Philippines
Quote: The Internet: Where men are men, women are men, and children are FBI agents.

www.flickr.com
This is a Flickr badge showing photos in a set called photos on the go. Make your own badge here.
Latest Articles
*

© Copyright 1997 - 2007 Chette Soriano. All rights reserved. Contact me.

* *