Oct 19 2007

Importance of 301 Permanent Redirection

Permanent Redirection


What is the difference between http://www.myhostname.com and http://myhostname.com ?

In most of the case you will get the same website. But if this is the actual scenario , why we redundantly use www, is it only for time consuming ?

Class B web development says that , no need to use www, we have to make a permanent redirection from www.myhost.com to myhost.com. This is what they called no-www

Refer : http://no-www.org/

Then from where does this www come ? Lets ask to w3c. Their answer is, when you host a domain name, say foo.com, for easy understanding they used
ftp.foo.com for their ftp server, and mail.foo.com for their smtp server (mail server). So they used aliaas name www for webserver. Thus www.foo.com came into action.

Refer: http://www.w3.org/Provider/Style/www.html

Anyway www is there. Then for which domain we will give importance. www.foo.com or mere foo.com

For a normal users angle there is no difference, expect he have to type 3 more letter in browsers location bar. But think about search engines, such a google.

When they use urls for page rank and back link calculations (for getting the relavacy and importance of a url), they consider www.foo.com and foo.com as two different domain.

The page rank for your url may get splitted into two better www and no-www url. This is a big factor in SEO (Search Engine Optimization).

So the solution for this is, you have redirect one form to other permanently (301),

either www.foo.com to foo.com
or
foo.com to www.foo.com

You can done this either via your apache’s configuration file or in .htaccess file in your web root.

The Rewrite rule for this redirection is as follows :

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

or

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

or in php you can do,

<?php
// Permanent redirection
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.somacon.com/”);
exit();

?>

Remember normal redirection never guide search engine by giving the information that the url is permanently shifted or moved

LEAVE A COMMENT

Subscribe Form

Subscribe to Blog

Sponsors

    Advt on sajithmr.com
    Advt on sajithmr.com
    Itslife Online
    Advt on sajithmr.com

Recent Comments

  • Binny V A: Thanks for the post - love the picture ;-)
  • TheAnand: A lot of people are seeing errors with google video chat….is there any other software which has to be...
  • Alex: Wow, interresting analysis you have done! I’m trying to run GoogleVoiceAndVideoSetup on linux, using...
  • Mella Fitriansyah: Nice plugin, I will try to add this plugin in my blog…
  • Mella Fitriansyah: Nice Info, Sir i will reading your another post success for you

Recent Readers

JOIN MY COMMUNITY!

Recent Posts