apache - Apply SSL only to main domain - .htaccess -
we have purchased free ssl hostgator. when upgrade package.
now, have 1 main domain (www.example.com) , 2 sub-domains (www.sub.example.com) & (www.sub.example.com).
i've inputted code .htaccess:
rewriteengine on rewritecond %{server_port} 80 rewriterule ^(.*)$ https://www.example.com/$1 [r=301,l]
main domain works fine, when want go sub-domain, redirected main domain => www.example.com .
i understand it's because of ^(.*)$
part, best solution this?
i want ssl main domain , http subdomains.
add condition exclude subdomain https redirection
rewriteengine on rewritecond %{http_host} !^(www\.)?sub\.domain\.com rewritecond %{server_port} 80 rewriterule ^(.*)$ https://www.example.com/$1 [r=301,l]
Comments
Post a Comment