Quick Tip: Forcing www. to avoid duplicate content
March 16, 2009Google (and other search engines) treats subdomains as different websites so if you are linked / accessed both via http://www.yourdomain.com and http://yourdomain.com you may get your content classified as duplicate since will be the same on both.
To avoid this simply add a rule to a .htaccess file in your root directory:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L] </IfModule>
NOTE: You need to have mod_rewrite enabled in your server in order to do this.