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

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -