Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]