Note this only works on an Apache server with mod_rewrite turned on.
Google recommends using www or not www but not both. In other words, use www.mydomain.com or mydomain.com but not both. Using a 301 permanent redirect can alleviate the problem.
To redirect mydomain.com to www.mydomain.com do the following:
In an existing .htaccess file or a new .htaccess file add the following code:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^mydomain.com [nc]
rewriterule ^(.*)$ http://www.mydomain.com/$1 [r=301,nc]
Replace mydomain with the domain you want to redirect. r=301 means redirect the client and send a status code of 301.
Doug
Pingback: Don’t Supplement the Supplemental Pages | Web Site Promotion