.htaccess 除了2个子目录外,如何在HTTPS上重定向整个网站?

.htaccess 除了2个子目录外,如何在HTTPS上重定向整个网站?,.htaccess,redirect,https,.htaccess,Redirect,Https,我想重定向我的整个网站以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_U

我想重定向我的整个网站以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]

试着制定这样的规则

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(north|south)(/.*)? [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

试着制定这样的规则

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(north|south)(/.*)? [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

你什么意思没有用?究竟发生了什么或没有发生什么?它根本不重定向吗?更多details@Panama杰克,一切都重定向到HTTPS。我只想保留HTTP上的子目录example.com/north/index.html。出什么问题了?将第一个条件保持为:
RewriteCond%{REQUEST\u URI}^/north/
你说的“无用”是什么意思?究竟发生了什么或没有发生什么?它根本不重定向吗?更多details@Panama杰克,一切都重定向到HTTPS。我只想保留HTTP上的子目录example.com/north/index.html。出什么问题了?将第一个条件保持为:
RewriteCond%{REQUEST\u URI}^/north/
嗨,巴拿马杰克和阿努巴瓦,谢谢你们的建议!它起作用了!:)嗨,巴拿马杰克和阿努巴瓦,谢谢你们的建议!它起作用了!:)