所以我在htaccess中有以下代码:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.no
RewriteRule ^(.*)$ https://www.mydomain.no/ [R,L]
但是,当我输入(m.mydomain.no)这样的子域时,它不会重定向到https,我该如何解决?谢谢
答案 0 :(得分:0)
检查此规则,对于http子域(非www),第二次:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.no
RewriteRule ^(.*)$ https://www.mydomain.no/ [R,L]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]