【问题标题】:Add-On Domain Redirects to HTTPS附加域重定向到 HTTPS
【发布时间】:2016-07-29 22:18:48
【问题描述】:

我有一个 GoDaddy 共享主机帐户,其中一个使用 SSL 的主域和一个我不想使用 SSL 的附加域。我想将非 https 重定向到主域的 https,但不是附加域。两个网站都使用 Wordpress。

需要明确的是,主域应该使用 https附加域不应使用 https。

我遇到的问题是 addondomain.com 正在重定向到 https://addondomain.com。

我知道这个问题可以通过我的 .htaccess 文件来解决,我已经做了几次尝试,但每次都以附加域重定向回主域结束。任何关于我需要对我的 .htaccess 文件进行更改的见解将不胜感激!

这是我的 .htaccess 文件的样子:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

【问题讨论】:

    标签: .htaccess redirect ssl https addon-domain


    【解决方案1】:

    如果您只想将主域重定向到 https,只需将以下条件添加到您的规则中:

    RewriteEngine On
    ##if host=="*maindomain.com"##
    RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$
    ##and scheme ==http(https off)##
    RewriteCond %{HTTPS} off
    ##then redirect the site to https
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    

    【讨论】:

      猜你喜欢
      • 2014-01-30
      • 2019-09-25
      • 1970-01-01
      • 2019-11-15
      • 1970-01-01
      • 2018-04-27
      • 1970-01-01
      • 2013-06-29
      • 2018-06-02
      相关资源
      最近更新 更多