如何将 https:// 重定向到 https://www
我知道如何从
http://domain.com 重定向到 https://www.domain.com
和
http://www. domain.com 到 https://www.domain.com
但不包括如何重定向:
< a href="https://domain.com" rel="noreferrer">https://domain.com 到 https://www.domain.com
我在虚拟服务器上使用端口 80 :(这工作正常)
RedirectMatch 301 ^/$ https://www.domain.com
RedirectMatch 301 ^(.*)$ https://www.domain.com
RedirectMatch 301 ^http://domain.com/$ https://www.domain.com
我尝试在虚拟服务器端口 443 上使用,但它不起作用。
Redirectmatch 301 ^https://domain.com/ https://www.domain.com
I know how to redirect from:
http://domain.com to https://www.domain.com
and
http://www.domain.com to https://www.domain.com
but not how to redirect from:
https://domain.com to https://www.domain.com
I am using on the virtual server for port 80 : (this works fine)
RedirectMatch 301 ^/$ https://www.domain.com
RedirectMatch 301 ^(.*)$ https://www.domain.com
RedirectMatch 301 ^http://domain.com/$ https://www.domain.com
I tried using on the virtual server port 443, but it does not work.
Redirectmatch 301 ^https://domain.com/ https://www.domain.com
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要拥有与 domain.com 匹配的证书以及标准 www.domain.com 证书,因为在建立 SSL 通道之前您无法重定向。
大多数人认为,仅仅为了实现重定向而为每个域获取两个证书是不值得的。通配符证书在这里没有帮助(我相信),因为我认为通配符证书涵盖的所有域都必须处于同一级别(例如 *.domain.com 对于 www.domain.com 和 www2.domain 有效.com,但不仅仅适用于域名.com)
You would need to have a certificate that matches domain.com, as well as your standard www.domain.com certificate, since you can't redirect until after an SSL channel has been established.
Most people wouldn't think it was worth the expense of obtaining two certificates for each domain, just to achieve a redirect. A Wildcard certificate wouldn't help here (I believe), since I think all domains covered by a wildcard cert have to be at the same level (e.g. *.domain.com would be valid for www.domain.com and www2.domain.com, but not for just domain.com)