这是我当前的VirtualHost
节点:
<VirtualHost *:80>
ServerName abc.com
ServerAlias abc.com www.abc.com
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/ [NC,R,L]
</VirtualHost>
它传达了每个请求:80来到此服务器将重定向到HTTPS
。现在,我想将or
和and
条件添加到VirtualHost
节点。所以,它将如下工作:
HTTPS
HTTPS
我该怎么办?
答案 0 :(得分:0)
你可以说:
RewriteCond %{HTTP_HOST} ^(www\.)?abc\.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/$1 [NE,R,L]
RewriteCond %{HTTP_HOST} ^(www\.)?xyz\.com$ [NC]
RewriteCond %{HTTPS} on
RewriteRule ^/?(.*)$ http://%{HTTP_HOST}/$1 [NE,R,L]