.htaccess Redirect/Rewrite
Tutorial
Part 1 - How do I redirect
all links for www.domain.com to domain.com ?
Description of the problem:
Your website can be accessed with www.domain.com and domain.com. Since
Google penalizes this due to duplicated content reasons, you have to
stick your domain to either www.domain.com or domain.com.
But - since some links are outside of your website scope and the search
engines already have indexed your website under both addresses, you
can't change that easily.
Solution:
Do a 301 redirect for all http requests that are going to the wrong url.
Example 1 - Redirect
domain.com to www.domain.com
RewriteEngine
On
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]