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

Posted

技术标签:

【中文标题】.htaccess:非 www 到 www(使用 https)在 Firefox 中显示 ssl_error_bad_cert_domain【英文标题】:.htaccess: non www to www (with https) shows ssl_error_bad_cert_domain in Firefox 【发布时间】:2016-03-17 17:05:58 【问题描述】:

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

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-Version而不适用于非www-Version吗?并且 Firefox 很重视这一点,而 Chrome 却忽略了它?

感谢您的帮助!

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

【问题讨论】:

【参考方案1】:

在 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 重定向到任何其他站点,您的证书必须包含 URL 中显示的名称,即 fit-for-easa.com 而不是 www.fit-for-easa.com。没有 htaccess 设置或 DNS 设置可以解决此问题,但必须修复证书。

【讨论】:

非常感谢您清晰而有帮助的回答!我将更新证书。

以上是关于.htaccess:非 www 到 www(使用 https)在 Firefox 中显示 ssl_error_bad_cert_domain的主要内容,如果未能解决你的问题,请参考以下文章

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

Htaccess 301将规则/ HTTP重定向到HTTPS /非www到www

.htaccess重定向(301):非WWW到WWW

非 www 到 www .htaccess 重定向不起作用? [复制]

在不使用 .htaccess 的情况下在 Wordpress 网站上重定向非 www

通过 htaccess 强制非 www 和 https