.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/

相关文章:

subdomain - 在子域中存储客户端文件(img、css、javascript)有什么好处?

macos - 如何在 Mac 上的本地主机上测试子域?

.htaccess 对除子域之外的所有内容强制使用 "www."并删除尾部斜杠

ssl - "A fatal error occurred while creating a TLS client credential. The internal error state is 10013."每 10 秒

css - GZIP CSS 完全破坏页面

php - 连接到 www.googleapis.com 时出现未知 SSL 协议(protocol)错误 :443 PHP google anaytlics api

eclipse - 向 webService 客户端提供 keystore

github - Github页面上自定义域的子域

php - 隐藏 file.php?id=12345 .htaccess 未应用

php - 如何制作国家/地区特定网站(和内容)?