【问题标题】:https for single domain .htaccesshttps 用于单域 .htaccess
【发布时间】:2016-03-22 16:34:12
【问题描述】:

我的主机帐户上有多个插件域。我想将非 https 重定向到主域的 https,即

  • andamanexoticholidays.com

我的 .htaccess 方法:

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

但这会让所有adon域默认强制使用ssl。

我的插件域是:

  • radhakrishnaresorthavelock.com

我的 sud 域是:

  • agents.andamanexoticholidays.com

我想强制使用

https 和 www。

任何帮助将不胜感激。

【问题讨论】:

    标签: apache .htaccess mod-rewrite


    【解决方案1】:

    使用 RewriteCondition 以便只有主域可以重定向到 https ,尝试:

    RewriteCond %{HTTP_HOST} ^(www\.)?andamanexoticholidays.com$
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://www.andamanexoticholidays.com %{REQUEST_URI} [L,R=301]
    

    【讨论】:

    • RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$ 或 RewriteCond %{HTTP_HOST} ^(www\.)?andamanexoticholidays\.com$ ???使用哪个
    • 使用第一个,你想强制 https。
    • RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$ RewriteCond %{HTTPS} !on RewriteRule (.*) maindomain.com%{REQUEST_URI} [L,R=301]不工作!!!
    猜你喜欢
    • 2012-06-05
    • 2016-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-06
    • 1970-01-01
    相关资源
    最近更新 更多