【问题标题】:HTACCESS "https" DETECTION?HTACCESS“https”检测?
【发布时间】:2013-07-29 10:51:47
【问题描述】:

来自.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 实例上。

【问题讨论】:

标签: .htaccess redirect mod-rewrite https amazon-ec2


【解决方案1】:

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

对于 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]

【讨论】:

    猜你喜欢
    • 2018-07-08
    • 1970-01-01
    • 2019-02-22
    • 2013-03-07
    • 1970-01-01
    • 2011-09-07
    • 2012-03-29
    • 2023-04-10
    • 1970-01-01
    相关资源
    最近更新 更多