To avoid duplicate content problem with search engines, you have to redirect all pages to one common URL.

This you can achieve using mod_rewrite of apache and .htaccess.

To redirect any URL starting with www.domain.tld to domain.tld, you have to add the following code to .htaccess file.

Do a 301 redirect for all http requests that are going to the wrong url.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.domain\.tld$ [NC]
RewriteRule ^(.*)$ http://domain.tld/$1 [R=301,L]
</IfModule>

or

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.tld$ [NC]
RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
</IfModule>

To redirect domain.tld to www.domain.tld -

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.tld$ [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [R=301,L]
</IfModule>

or

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.tld$ [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [L,R=301]
</IfModule>

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

Share or Bookmark This Post With :

One Comment
Short Url Redirect Posted On November 28th, 2009

Please note the Google PageRank goes up to 10 and the best alexa rating is 1. Short Url Redirect

Leave a Reply

Subscribe to RSS Feeds Follow me on Twitter Add to Favourite
 
Sponsors
 
Tags
 
Network [+]
 
© Copyright 2009 - 2011 TechiePark.com. All Rights Reserved | Powered by WordPress
This work is licensed under a Creative Commons Attribution 3.0 Unported License
Php5 powered    Mysql powered    Apache powered   Best viewed with  Spread Firefox Affiliate Button