regex - How to force HTTPS to subdomain (no www) -
how can force user following url while forcing https?
https://subdomain.hostname.com/request-uri
from of these links:
http://hostname.com/request-uri
http://www.hostname.com/request-uri
https://hostname.com/request-uri
https://www.hostname.com/request-uri
i tried:
rewriteengine on rewriterule .* https://subdomain.hostname.com%{request_uri} [l,r=301]
and:
rewriteengine on rewritebase / rewritecond %{http_host} ^(www\.)?hostname\.com$ rewritecond %{https} off rewriterule ^(.*)$ https://subdomain.hostname.com%{request_uri} [l,r=301]
without having success...
you can use :
rewriteengine on rewritebase / rewritecond %{http_host} ^(?:www\.)?hostname\.com$ rewriterule ^(.*)$ https://subdomain.hostname.com%{request_uri} [l,r=301]
clear browser cache before testing this.
Comments
Post a Comment