简体   繁体   English

将所有流量重定向到SSL页面

[英]Redirect to all traffic to SSL pages

I am attempting to redirect all traffic to Secure pages. 我正在尝试将所有流量重定向到安全页面。 I attempted an to try using either a PHP redirect, and an htaccess redirect. 我试图尝试使用PHP重定向和htaccess重定向。 They worked, BUT, the problem is I get the following error: 他们工作了,但是,问题是我得到了以下错误:

"You attempted to reach domain.com, but instead you actually reached a server identifying itself as www.domain.com. This may be caused by a misconfiguration on the server or by something more serious. An attacker on your network could be trying to get you to visit a fake (and potentially harmful) version of domain.com." “您试图访问domain.com,但实际上是到达一台将自身标识为www.domain.com的服务器。这可能是由于服务器上的配置错误或更严重的原因所致。您网络上的攻击者可能试图让您访问domain.com的伪造(可能有害)版本。”

We are the same domain. 我们是同一个域。 How do I go fixing the problem of the SSL certificate working for one domain but no the other domain? 如何解决SSL证书适用于一个域但不适用于其他域的问题?

You're getting that error because the SSL cert that you have seems to be for www.domain.com and not domain.com . 您收到该错误消息是因为您拥有的SSL证书似乎是针对www.domain.com不是 domain.com You're not going to be able to avoid this if people attempt to go to https://domain.com but you can canonicalize this using the same rule for redirecting to SSL: 如果人们尝试访问https://domain.com ,您将无法避免这种情况,但是您可以使用重定向到SSL的相同规则对它进行规范化:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^ https://www.domain.com%{REQUEST_URI} [L,R=301]

See also: http://www.digicert.com/ssl-support/certificate-name-mismatch-error.htm 另请参阅: http : //www.digicert.com/ssl-support/certificate-name-mismatch-error.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM