htaccess Redirect (non-www to www)

Currently i am actively improving our SEO rating by tweaking our website, servers and the URL. One important step is to use a redirect (301 redirect) when users enter the website with www in front of the address. Reason for this is because google will see and as two seperate websites. This hurts your ranking.

The solution is creating one .htaccess file that redirects all www hits to non-www hits.

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]