You can add another condition to make sure this rule is applied for main domain only:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule !^efr https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NC]
Pergunta
I would want to force HTTPS for entire website except:
For, one directory named efr I have done something as:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !efr [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
And now condition for sub-domain is remaining. I want to stop HTTPS for: sub-domain.domain.com and only domain.com should be HTTPS.
Please let me know how can I achieve this.
Thanks
Solução
You can add another condition to make sure this rule is applied for main domain only:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule !^efr https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NC]