【问题标题】:forcing https with www & subdomain without https htaccess在没有 https htaccess 的情况下强制使用带有 www 和子域的 https
【发布时间】:2014-06-12 11:25:26
【问题描述】:

我的 htaccess 配置需要帮助。

我的以下 htaccess 锁是这样的:

RewriteCond %{HTTP_HOST} ^(.+-abc.*|def|www)\.domain\.com$
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]

结果: 一切正常,但这个 domian 不会将我重定向到 https:

domain.com => https://www.domain.com [fail]

【问题讨论】:

    标签: .htaccess mod-rewrite redirect https subdomain


    【解决方案1】:

    在主机名中使第一部分可选:

    RewriteCond %{HTTP_HOST} ^(?:(.+-abc.*|def|www)\.)?domain\.com$
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
    

    【讨论】:

      猜你喜欢
      • 2015-07-18
      • 2014-01-20
      • 1970-01-01
      • 2016-06-15
      • 2013-05-31
      • 2016-03-20
      • 2016-04-05
      • 2013-07-24
      • 2016-06-02
      相关资源
      最近更新 更多