Enforce www on domain names

There are many samples around this. But I find the following one if you’re parking many domains on the same hosting…

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

A very useful tutorial around .htaccess I found is here.