0

.htaccess我无法检测到是否https

我只需要,如果我点击:

在我的.htaccess

RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ https://www.secure-site.com [R=301,L,NS]

RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.pure-site.com [R=301,L,NS]

但它永远无法检测 RewriteCond %{HTTPS} on到。
我在负载平衡的 AWS/EC2 实例上。

4

1 回答 1

0

如果正确理解您,这应该可以完成工作。

对于 https:

RewriteEngine On
RewriteCond %{HTTPS} ^on$
RewriteRule (.*) https://www.yourdomain/$1 [R,L]

对于 http:

    RewriteEngine On
    RewriteCond %{HTTP} ^on$
    RewriteRule (.*) http://www.yourdomain/$1 [R,L]
于 2013-07-29T12:01:05.360 回答