【问题标题】:Enforce https without www for subdomain对子域强制使用不带 www 的 https
【发布时间】:2016-03-20 21:11:45
【问题描述】:

我有 phpbb 论坛,我希望只能通过 SSL 查看。

举个例子

如果 www.subdomain.domain.com - https://subdomain.domain.com 要么 如果 subdomain.domain.com - https://subdomain.domain.com

我尝试了几个答案,但我发现它们都没有正常工作。一些返回 500 内部服务器错误,一些不只执行 SSL。

谁能推荐我可以在 htaccess 中使用的东西?

【问题讨论】:

  • 我在下面发布了一个答案,如果您对答案感到满意,请接受它,否则请告诉我如何改进它。

标签: .htaccess ssl subdomain


【解决方案1】:

试试

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www\.)?sub.domain.com
RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://subdomain.com/$1 [L,R]

【讨论】:

    猜你喜欢
    • 2014-01-20
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 2016-06-02
    • 2014-06-12
    • 1970-01-01
    • 2015-07-18
    • 1970-01-01
    相关资源
    最近更新 更多