Redirecting your domain.com to www.domain.com
April 19th, 2010
With people taking steps to make their website search engine friendly, there are some basic things which can be done to get on the better side of Google. Redirecting non www domains to www domains avoids the issue of duplicate content being indexed on search engines.
Below is the code which you need to put in your .htaccess which will redirect any user who types in yourdomain.com to www.yourdomain.com
RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Please change example.com to your website url.