你如何配置Apache / PHP接受查询字符串斜线? [英] How do you configure Apache/PHP to accept slashes in query strings?

查看:188
本文介绍了你如何配置Apache / PHP接受查询字符串斜线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有运行PHP两个Apache服务器。一个人接受查询字符串向前斜杠,并在预期的方式将它传递到PHP,例如:

I have two Apache servers running PHP. One accepts forward-slashes in the query string and passes it along to PHP in the expected way, for example:


http://server/index.php?url=http://foo.bar

作品和在PHP这个前pression是正确的:

works and in PHP this expression is true:

$_REQUEST['url'] == "http://foo.bar"

然而,在其他的Apache服务器,同样的网址在 403禁止错误的结果!请注意,如果查询字符串是正确网址转义(即与%2F ,而不是正斜杠),则一切正常。

However, in the other Apache server, the same URL results in a 403 Forbidden error! Note that if the query string is properly URL-escaped (i.e. with %2F instead of forward-slash), then everything works.

显然有一个在Apache或者PHP配置导致此差一些,但我想不出什么!

Clearly there's some difference in the Apache or PHP configuration that causes this, but I can't figure out what!

我要的接受的这种形式在两种情况下的URL,而不是拒绝它。

I want to accept this form of URL in both cases, not reject it.

推荐答案

HTTP://server/index.php URL =的 http://foo.bar 不是一个有效的URL。你必须设有code中的斜线。我认为浏览器这样做自动的,所以也许你用不同的浏览器测试?

http://server/index.php?url=http://foo.bar is not a valid url. You have to encode the slashes. I think browsers do this automagically, so maybe you were testing with different browsers?

也许它的 AllowEn codedSlashes 设置?

这篇关于你如何配置Apache / PHP接受查询字符串斜线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆