I have this bit of code in my root .htaccess that’s been there forever. Looking at it now I don’t think it’s doing anything. I haven’t removed it because I’m just not sure!
RewriteCond %{SERVER_PORT}s ^(80s|443(s))$
RewriteCond %2-%{HTTP_HOST} ^(s?)-(mysite\\.com)$ [NC]
RewriteRule ^(.*)$ http%1://www.%2/$1 [R=301,L]
It looks to me like the conditions will ALWAYS match, regardless of whether the request uses https or not. Though if it did, that would mean a redirect loop.
I don’t think it’s right, but does it look like it’ll do anything?
There’s a slightly different version in one of the subdirectories:
RewriteCond %{SERVER_PORT}s ^(80s|443(s))$
RewriteCond %2-%{HTTP_HOST} ^(s?)-(mysite\\.com)$ [NC]
RewriteRule .* http%1://www.%2%{REQUEST_URI} [R=301,L]