.htaccess redirect - automatically add www. if no subdomain exists
snippet in htaccess

.htaccess redirect - automatically add www. if no subdomain exists

user5283

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