apache - HTTPS for www and non-www only - HTTP for all subdomains -
i have certificate single domain only, including www. current .htaccess setup, redirecting http requests https. want make following:
- force https domain.com (www , non-www)
- allow http subdomains *.domain.com
is possible?
my current .htaccess setup forces use https
# force ssl rewritecond %{https} !=on rewriterule ^ https://%{http_host}%{request_uri} [l,r=301]
i have found 1 solution:
# force https www rewritecond %{https} off rewritecond %{http_host} ^(?:www\.)(domain\.com)$ [nc] rewriterule ^ https://www.%1%{request_uri} [r=301,l] # force http subdomains rewritecond %{https} on rewritecond %{http_host} ^((?!www).+\.domain\.com)$ [nc] rewriterule ^ http://%1%{request_uri} [r=301,l]
Comments
Post a Comment