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

use*_*320 5 .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.
Run Code Online (Sandbox Code Playgroud)

这是我的.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>
Run Code Online (Sandbox Code Playgroud)

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

谢谢您的帮助!

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

Ste*_*ich 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
Run Code Online (Sandbox Code Playgroud)

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