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