Redirect non www to www http:// and https://
I was on the search today to figure out how to redirect all traffic from a non-www address to a www address and also keep the SSL in the redirect using htaccess. The following code will allow this to work. RewriteEngine On RewriteCond %{HTTP_HOST} ^+$ RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} So if you visit mydomain.com it will redirect to www.mydomain.com If you visit https://mydomain.com it will redirect you https://www.mydomain.com If you visit subdomain.mydomain.com it will NOT Read More
