我想:
这就是我所拥有的:
#enable SSL excluding /PHP directory
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule !^php/.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#Enable SSL and add "www." if missing
RewriteEngine On
RewriteCond %{HTTP_HOST} !=""
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ https%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
问题/问题:
非常感谢任何帮助!
答案 0 :(得分:0)
根据您的评论,规则应如下所示:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$ [NC]
RewriteCond %{SERVER_PORT} !=443
RewriteRule !^(php/.*|.*noSSL\.htm)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
因此noSSL.htm
将被排除在外。
注意:清除浏览器缓存,然后进行测试。