假设我有一个网站xxxx.com/,我想将任何页面重定向到https,除了带有/ admin /的页面,例如xxxx.com/admin/xxx.php将使用http。
我试图关注How to force rewrite to HTTPS except for a few pages in Apache?
我想出了这个
RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_URI} !^\/admin\/
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301]
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} ^\/admin\/
RewriteRule (.*) http://%{HTTP_HOST}/$1 [L,R=301]
但是这不起作用,我输入xxxx.com/admin并重定向到https://xxxx.com/cgi-bin/php55.cgi/admin/index.php
我该如何解决这个问题?