我搜查,发现数百个相关案件,但没有完全按照我的需要。 我需要重定向的组合,请执行以下操作:
访问:
mysite -redirected于─> www.mysite
在
www.mysite -redirected于─> mysite
对于普通的 HTTP 网站,我想迫使 WWW
但SSL证书只能加www,所以 HTTPS 应的不可以有WWW。
感谢,如果有人能帮助我。
解决方案从 www.mysite 重定向到 HTTPS ://mysite 只能发生在客户端后,已经取得了初步的要求 www.mysite
有关此初始连接到工作中,服务器 www.mysite 必须具有有效的 www.mysite证书.COM ,否则,这种连接甚至不会发生(和服务器将不发送重定向响应)。
如果你仍然想重定向,在同一台服务器上,服务器必须present的证书有效期为要服务的主机名。你应该得到两个主题备用名称的DNS条目的证书: mysite 和 www.mysite ;这将允许您使用相同的证书,同时服务于主机(然后如果需要使用重写规则)。
(你也可以使用服务器名称指示与两个不同的证书,如果你希望客户端来支持它,但是这通常是完全不同的主机名。)
这是相当普遍的CA颁发证书的有效期为两个 mysite 和 www.mysite 。
I searched and found hundreds of related cases, but none exactly as what I need. I need a combination of redirects to do the following:
Access to :
mysite -redirected to-> www.mysiteWhile:
www.mysite -redirected to-> mysiteFor normal http site, I want to force www.
But the ssl certificate only works without www, so https should not have the www.
Thanks if anyone can help me.
解决方案The redirection from www.mysite to mysite can only happen after the client has made an initial request to www.mysite.
For this initial connection to work, the server at www.mysite must have a certificate valid for www.mysite, otherwise, this connection won't even happen (and the server won't send a redirection response).
If you still want a redirection, on the same server, your server must present a certificate that is valid for the host names you want to serve. You should get a certificate with two Subject Alternative Name DNS entries: mysite and www.mysite; this will allow you to serve both hosts with the same certificate (and then use the rewrite rules if needed).
(You could also use Server Name Indication with two distinct certificates, if you expect the clients to support it, but that's usually for completely different host names.)
It's quite common for CAs to issue certificates that are valid for both mysite and www.mysite when you apply for one of the other, sometimes without an extra fee.
更多推荐
HTTPS重定向到非www和http到www
发布评论