问题
I recently purchased a security certificate for a website valid for www.example.com but not for *.example.com (wildcard version - more expensive) The problem i have now is that although users can type http://example.com , the secure version (ssl enabled pages) https://example.com raises the invalid certificate exception - which is totally understandable.
How can i redirect https traffic to the www.example.com version before the request actually hits the server? i tried url rewritting and redirects without any luck. any ideas ?
The website is built using ASP.NET and Hosted on an IIS 7 server.
Thanks!
回答1:
Spend another few bucks for a (~$30 at Godaddy) for a cheap cert for the shorter domain example.com.
It seems unlikely that a significant number of users users are typing in https://example.com. If they are typing in an address they are probably using http:// or nothing. You should be able to setup 2 virtual hosts, one for http://example.com/, and one for http(s)://www.example.com. Redirect everything from example.com to www.example.com
SSL is negotiated first, so there isn't really anything you can do to redirect connections from https://example.com to https://www.example.com if https://example.com has an invalid certificate.
来源:https://stackoverflow.com/questions/449212/invalid-security-certificate-and-domain-names