Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.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
Redirect 在Apache2中重定向时出现过多重定向错误_Redirect_Apache2 - Fatal编程技术网

Redirect 在Apache2中重定向时出现过多重定向错误

Redirect 在Apache2中重定向时出现过多重定向错误,redirect,apache2,Redirect,Apache2,我正在使用Apache2(2.4.46)和一个简单的重定向,我得到了太多的重定向错误 我想要的是: 当流量达到https://www.example.com/我想将其重定向到https://www.example.com/Shibboleth.sso/SAML2/POST 在我的VirtualHost定义中,我在httpd.conf中使用了一个简单的重定向,它说: 重定向//Shibboleth.sso/SAML2/POST 当我测试w/curl时,我看到了以下内容(编辑为隐藏真实主机名): [

我正在使用Apache2(2.4.46)和一个简单的
重定向
,我得到了
太多的重定向
错误

我想要的是: 当流量达到
https://www.example.com/
我想将其重定向到
https://www.example.com/Shibboleth.sso/SAML2/POST

在我的VirtualHost定义中,我在httpd.conf中使用了一个简单的重定向,它说: 重定向//Shibboleth.sso/SAML2/POST

当我测试w/curl时,我看到了以下内容(编辑为隐藏真实主机名):

[oracle@my-服务器~]$./redirects.sh


找到HTTP/1.1 302 ->地点: 找到HTTP/1.1 302 ->地点: 找到HTTP/1.1 302 ->地点: 找到HTTP/1.1 302 ->地点:

找到HTTP/1.1 302 ->地点: 找到HTTP/1.1 302 ->地点: 找到HTTP/1.1 302 ->地点:

所以,我知道发生了什么,但我不知道如何预防它。我希望
重定向
工作一次,然后终止


帮助?

您需要使用下面的重定向,该重定向仅对根url执行
/

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) /Shibboleth.sso/SAML2/POST/ [R=302]

最初,您应该配置
R=302
,当它工作时,您可以将其更改为
R=301
,以便浏览器将缓存重定向

如果它出现在其他url上,如
/abc
?那么需要发生什么呢?