1

First I bought a multi-domains SSL certificate that doesn't allow wildcards (ex. *.mydomain.com).

When I want to connect to my website and if I go through https://mydomain.com it works fine. Now, if I go through https://www.mydomain.com I have a nice alert page from my browser saying I've got to add an exception, blahblahbla... So I understand I've got this alert because the SSL certificate doesn't manage www wildcard.

I decided to create a rule in htaccess in order to redirect user from https://www.mydomain.com to https://mydomain.com. But my browser seems not to understand this rule, and each time I go through https://www.mydomain.com I stay on https://www.mydomain.com.

Here is my rule :

RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteRule ^(.*)$ https://mydomain.com/$1 [L,R=301]

For information, I use Virtualmin to manage my domains.

Thanks!

4

1 回答 1

2

不幸的是.htaccess,或者mod_rewrite不会对消除浏览器安全警告有任何帮助。

原因是 SSL 证书协商发生在mod_rewrite有机会开始之前。

当您购买 SSL 证书时,我相信您可以选择同时适用于 www 和非 www 域的证书。

于 2013-10-04T15:20:07.570 回答