Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 如何修复错误ERR\u TOO\u多个重定向。htaccess?_.htaccess_Ssl_Https - Fatal编程技术网

.htaccess 如何修复错误ERR\u TOO\u多个重定向。htaccess?

.htaccess 如何修复错误ERR\u TOO\u多个重定向。htaccess?,.htaccess,ssl,https,.htaccess,Ssl,Https,我已经有一个SSL证书处于活动状态,但想强制使用https,并且已经尝试了一些规则,但总是产生相同的错误 我的规则: RewriteEngine on RewriteCond %{HTTPS} !=on [NC] RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] 重定向对我来说很有效。确保没有任何缓存结果 ➜ ~ curl -i www.ingmega.com/syspagos HTTP/1.1 301 Moved

我已经有一个SSL证书处于活动状态,但想强制使用https,并且已经尝试了一些规则,但总是产生相同的错误

我的规则:

RewriteEngine on

RewriteCond %{HTTPS} !=on [NC]

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


重定向对我来说很有效。确保没有任何缓存结果

➜  ~  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.
➜  ~  curl-i www.ingmega.com/syspagos
HTTP/1.1 301永久移动
日期:2016年2月2日星期二19:22:12 GMT
服务器:Apache
地点:https://syspagos.ingmega.com
内容长度:236
内容类型:text/html;字符集=iso-8859-1
301永久搬迁
永久移除
文档已移动

➜ ~ curl-ihttps://syspagos.ingmega.com curl:(60)SSL证书问题:自签名证书 详情如下:http://curl.haxx.se/docs/sslcerts.html curl默认情况下使用“bundle”执行SSL证书验证 颁发证书机构(CA)公钥(CA证书)。如果默认 捆绑文件不足,您可以指定一个备用文件 使用--cacert选项。 如果此HTTPS服务器使用由中表示的CA签名的证书 对于捆绑包,证书验证可能由于错误而失败 证书有问题(可能已过期,或者名称可能已过期) 与URL中的域名不匹配)。 如果要关闭curl对证书的验证,请使用 -k(或--unsecure)选项。

但是,请注意,您的站点正在返回自签名证书。您提供的证书不可信。

到底是什么问题?我总是收到一个错误,说页面有重定向循环。您的代码正常。你有其他规则吗?是的,我尝试使用不同的规则,总是抛出相同的错误请在你的问题中发布它们。删除缓存,尝试从另一台PC、移动设备的另一个浏览器,总是抛出相同的错误,证书不存在问题,在url中删除规则Htacces和使用https直接访问会显示来自不同计算机的安全连接,并比较
curl
的结果。您的机器的
curl
结果如何?