我想将我的整个网站重定向到以HTTPS开头,除了我希望保留在HTTP上的2个子目录。
我尝试了以下但无济于事。请指教。
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/north/index.html$
RewriteCond %{REQUEST_URI} !^/south/index.html$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
答案 0 :(得分:2)
尝试并拥有这样的规则
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(north|south)(/.*)? [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]