简体   繁体   English

如何将https://重定向到https:// www

[英]how to redirect https:// to https://www

I know how to redirect from: 我知道如何重定向:

http://domain.com to https://www.domain.com http://domain.comhttps://www.domain.com

and

http://www.domain.com to https://www.domain.com http://www.domain.comhttps://www.domain.com

but not how to redirect from: 但不是如何重定向:

https://domain.com to https://www.domain.com https://domain.comhttps://www.domain.com

I am using on the virtual server for port 80 : (this works fine) 我在虚拟服务器上使用端口80 :(这很好)

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. 我尝试在虚拟服务器端口443上使用,但它不起作用。

Redirectmatch 301 ^https://domain.com/ https://www.domain.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. 您需要拥有与domain.com相匹配的证书以及您的标准www.domain.com证书,因为在建立SSL通道之前您无法重定向。

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 (eg *.domain.com would be valid for www.domain.com and www2.domain.com, but not for just domain.com) 通配符证书在这里没有帮助(我相信),因为我认为通配符证书涵盖的所有域必须处于同一级别(例如* .domain.com对www.domain.com和www2.domain有效) .com,但不仅仅是domain.com)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM