301 Redirect non-www to www
Simply copy and paste the code below in an existing .htaccess file at the root of your domain
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Then replace “example.com” on both lines with your domain name
301 Redirect non-www to www
For a complete explanation on how to 301 redirect non-www to www URLs, please visit http://www.stepforth.com/