【问题标题】:Force HTTP://subdomain. and HTTP://domain. to HTTPS (with .htaccess)强制 HTTP://子域。和 HTTP://域。到 HTTPS(使用 .htaccess)
【发布时间】:2017-07-05 04:14:34
【问题描述】:

我有一个关于重定向到 HTTPS 的快速问题。

我想要

到 到

我怎样才能做到这一点?关键是,我有几个域链接到一个目录,我只想使用一个 SSL 证书。

感谢所有可以帮助我的人:-)

亲切的问候

【问题讨论】:

    标签: .htaccess ssl mod-rewrite


    【解决方案1】:

    今天经过几个小时的搜索,我终于找到了解决方案。也许它对你有用,所以我想分享:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.tld [NC]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.domain.tld/$1 [R,L]
    
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.domain\.tld$
    RewriteRule ^ https://%1.domain.tld%{REQUEST_URI} [NE,L,R]
    

    :-)

    【讨论】:

      猜你喜欢
      • 2014-08-15
      • 1970-01-01
      • 2015-07-18
      • 2018-06-24
      • 2014-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多