如何修复错误ERR_TOO_MANY_REDIRECTS .htaccess?

时间:2016-02-02 14:57:21

标签: .htaccess ssl https

我已经激活了SSL证书,但是想要强制使用https,并且已经尝试过我已经尝试了几条规则,但总会产生相同的错误。

我的规则:

RewriteEngine on

RewriteCond %{HTTPS} !=on [NC]

RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Error

Error 2

1 个答案:

答案 0 :(得分:0)

重定向适用于我。确保您没有任何缓存结果。

➜  ~  curl -i www.ingmega.com/syspagos
HTTP/1.1 301 Moved Permanently
Date: Tue, 02 Feb 2016 19:22:12 GMT
Server: Apache
Location: https://syspagos.ingmega.com
Content-Length: 236
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://syspagos.ingmega.com">here</a>.</p>
</body></html>

➜  ~  curl -i https://syspagos.ingmega.com
curl: (60) SSL certificate problem: self signed certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

但请注意,您的网站正在返回自签名证书。您提供的证书不受信任。