i rewrite all non-www requests to www with:
RewriteCond %{HTTP_HOST} !^www\\.mydomain\\.de$ RewriteRule ^(.*)$ http://www.mydomain.de/$1 [L,R=301]
You can use this code:
## add www to a domain name RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
This will perform: