.htaccess - 为子域强制执行不带 www 的 https

标签 .htaccess ssl subdomain

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

举个例子

如果 www.subdomain.domain.com - https://subdomain.domain.com 或者 如果 subdomain.domain.com - https://subdomain.domain.com

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

谁能给我一些可以在 htaccess 中使用的建议?

最佳答案

尝试

RewriteEngine on

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

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

关于.htaccess - 为子域强制执行不带 www 的 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34283117/

相关文章:

.htaccess - 子域的 HTTPS 转发

login - 使用网站的子域登录用户

PHP imap_open() => [AUTHENTICATIONFAILED] for imap.gmail.com

java - 相互SSL-以正确的格式获取 key /信任库

php - file_get_contents 忽略 verify_peer=>false?

apache - 如何将 .htaccess 拒绝操作更改为 "abort"

.htaccess - 子域重定向错误 + Htaccess,困惑?

apache - PERL Dancer2、cgi 调度程序和 uri_for 助手

.htaccess url 使用 ssl 重定向重写

.htaccess - 删除 .HTACCESS 文件中的所有扩展名