.htaccess:非www到www(带https)在Firefox中显示ssl_error_bad_cert_domain

时间:2015-12-11 17:40:12

标签: .htaccess mod-rewrite ssl https no-www

我遇到了重定向问题,并没有在整个网络上找到解决方案......

The right domain is: https://www.fit-for-easa.com

The following redirections DO work:
http://fit-for-easa.com to https://www.fit-for-easa.com
http://www.fit-for-easa.com to https://www.fit-for-easa.com

But the problem is with:
https://fit-for-easa.com

In Chrome it is forwarded correctly to https://www.fit-for-easa.com - 
but not in Firefox what seems very strange to me. 
Firefox shows ssl_error_bad_cert_domain.

这是我的.htaccess文件:

AddType image/svg+xml svg svgz
AddEncoding gzip svgz

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://www.fit-for-easa.com%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

可能问题是证书只适用于www版本而不适用于非www版本吗? Firefox认为这一点至关重要,而Chrome忽略了它?

感谢您的帮助!

(很抱歉,我将文字标记为代码,但我没有足够的声誉来发布两个以上的链接 - 我正在努力!)

1 个答案:

答案 0 :(得分:4)

  

在Chrome中,它会正确转发到https://www.fit-for-easa.com -   但不是在Firefox中对我来说似乎很奇怪。   Firefox显示ssl_error_bad_cert_domain。

对我来说,它在Chrome中无效。也许它对您有用,因为您之前已经添加了例外。原因很简单:名称fit-for-easa.com不包含在证书中,只包含www前缀的名称。从证书:

 Subject: OU=Domain Control Validated, OU=PositiveSSL Multi-Domain, CN=3wertig.com
 ...
 X509v3 Subject Alternative Name: 
 DNS:3wertig.com, DNS:www.fit-for-easa.com, DNS:www.steuerberatung-zodel.de

要从https://fit-for-easa.com重定向到任何其他网站,您的证书必须包含网址中显示的名称,即fit-for-easa.com而不是www.fit-for-easa.com。没有htaccess设置或DNS设置可以解决此问题,但必须修复证书。