我安装了域和 SSL 证书。它不是通配符 SSL。
我们为托管在他们服务上的其中一个子域进行了第三方 url 重写 - 这是我无法摆脱或控制的。
他们在子域上没有 SSL。现在我已经安装了 SSL,子域也总是重定向到 https,这会引发错误。
我希望子域转到 http 而主域只转到 https。
我的 htaccess 中最初有以下内容:
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
我已经删除了它,所有内容仍然指向 https。
最佳答案
We have a third-party url rewrite for one of the subdomains that is hosted on their services
这是在您的 .htaccess 文件之外进行的操作吗?这个第 3 方重写可能会导致问题。
但是,如果您只想忽略子域,只需将其添加到规则即可。
RewriteEngine on
RewriteCond %{HTTPS} !^on
RewriteCond %{HTTP_HOST} !^subdomain\.example\.com [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
关于apache - 强制使用主域和 www.但不是子域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29433830/