mod rewrite - .htaccess How to Exclude One Site From SSL? -
i'm trying exclude 1 site using ssl, can't seem directive right. want addon domains use ssl except example.com. (because startssl difficult along with)
# enable https rewritecond %{https} off #rewriterule (.*) https://%{http_host}:443%{request_uri} rewriterule !^example.com(/|$) https://%{http_host}:443%{request_uri}
what you're trying not work. ssl handshake initialized before request data sent server, therefore, you're going certificate exception if goes https://example.com
no matter do.
if certificate exception isn't concern, need match against %{http_host}
variable:
rewriteengine on rewritecond %{https} off rewritecond %{http_host} !^(www\.)?example\.com$ [nc] rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301]
then if need:
rewritecond %{https} on rewritecond ^{http_host} ^(www\.)?example\.com$ [nc] rewriterule ^(.*)$ http://%{http_host}%{request_uri} [l,r=301]
Comments
Post a Comment