Gatzet.com

Gadget, Free Software, Reviews

Using mod-rewrite .htaccess redirection

Sometime using an url with WWW is more preferable instead of non-WWW url. In my opinion a short domain name (usually less than 7 letters) is better using WWW, and for the longer domain name is better without WWW.

Basically there are no big different between url with WWW and non-WWW, since both url delivers all visitors to the same website. Sometime it looks annoyed when you click an url with WWW, but it delivers you to non-WWW version. Therefore combining those url either with WWW on without WWW, will give confidence for the visitor.

For SEO reason, combining url ensures that your page won’t be double indexed by the search engines. Google bot does a pretty good job on indexing your page and it could create two distinct index for each url even though they are 100% identical in content. Obviously these duplication is not good for SEO. To change this url without your visitor ever noticed, is easy using .htaccess redirection.

You can combine these url using .htaccess 301 redirect. Just put the following code on your top of .htaccess file and it will seamlessly deliver your visitor from non-WWW url to WWW url.


RewriteEngine on
RewriteCond %{HTTP_HOST} ^gatzet.com [NC]
RewriteRule ^(.*)$ http://www.gatzet.com/$1 [L,R=301]

If you want to set your url from WWW to non-WWW, use the following code.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.gatzet.com [nc]
RewriteRule (.*) http://gatzet.com/$1 [R=301,L]

Bookmark and Share
 

Posted on May 24th, 2007   Tags: ·

True UNLIMITED Web Hosting Reseller + GET FREE EXTRAS!
US $19.95
End Date: Wednesday Dec-03-2008 16:01:20 PST
Buy It Now for only: US $19.95
Buy it now | Add to watch list

+ Make 75K / Year! Web Hosting Bus. (Hosting Reseller)
US $14.99
End Date: Wednesday Dec-03-2008 16:05:21 PST
Buy It Now for only: US $14.99
Buy it now | Add to watch list

Product for visitor from UK

Unlimited Web Hosting 3 YEARS FOR THE PRICE OF 1 $14.95
GBP 6.44
End Date: Wednesday Dec-03-2008 18:30:00 PST
Buy It Now for only: GBP 6.44
Buy it now | Add to watch list

3 YEARS UNLIMITED WEB HOSTING - Control panel & more...
GBP 1.99
End Date: Wednesday Dec-03-2008 19:24:45 PST
Buy It Now for only: GBP 1.99
Buy it now | Add to watch list

2 comments for this entry ↓

  • 1 rewrite guru // May 25, 2007 at 2:31 pm

    I prefer this code:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.gatzet\.info [NC]
    RewriteRule (.*) http://www.gatzet.com/1 [R=301,L]

  • 2 admin // May 25, 2007 at 2:39 pm

    Thanks, for the code.

    I’ll give that try

Leave a Comment