HTACCESS Redirect to WWW

RewriteEngine On

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

http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/