I've been working with many rules for forcing SSL via .htaccess, but I can't find one that will only force for "www" and not any other subdomain.
In example :
www.website.com - OK
blog.website.com - Not OK
Any help would be greatly appreciated.
You can use:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond {HTTP_HOST} ^www\.website\.com$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
RewriteCond %{HTTPS} on
RewriteCond {HTTP_HOST} !^www\.website\.com$ [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.