在URL休息%2F,根本不涉及到所需要的PHP文件 [英] %2F in URL breaks and does not reference to the .php file required
问题描述
我需要通过/作为一个变量作为URL的一部分。
I need to pass / as a variable as part of a URL.
我的结构如下所示:
www.domain.com/listings/page-1/city-Burnaby+South/type-Townhome/bedroom-2/bathroom-2
My structure looks like this: www.domain.com/listings/page-1/city-Burnaby+South/type-Townhome/bedroom-2/bathroom-2
在这种情况下,最终归结为listings.php和一切超越它成为taht我的PHP脚本通过使用$ _ SERVER ['REQUEST_URI'] VAR分析参数。
In this case, it ultimately boils down to listings.php and everything else beyond it becomes parameters taht my PHP script parses through using the $_SERVER['REQUEST_URI'] var.
然而,当兴田变量中的一个变成公寓/公寓和/变为通过时产生的URL urlen code()在PHP%2F,整个事情扼流圈和我得到一个Not Found错误。
However when one of hte variables becomes "Apartment/Condo" and the / becomes %2F via urlencode() in PHP when the URL is generated, the whole thing chokes and I get a "Not Found" error.
如何通过/不破的网址是什么?我在想什么?我认为,这些urlen code整点()字符(%2F,20%等),在那里躲避这些问题。
How do I pass the / without breaking the URL? What am I missing? I thought the whole point of these urlencode() characters (%2F, %20 etc.) were there to escape these issues.
推荐答案
网址中的%2F 的 /
或%5C \\
返回的 404 的从的Apache
出于安全目的。
Urls with %2f /
or %5c \
return a 404 from Apache
for security purposes.
您可以修改Apache的配置,以使 AllowEn codedSlashes在
或节点code
。请记住,这可能会带来意想不到的安全问题,这这个功能旨在缓解。
You may modify Apache config to enable AllowEncodedSlashes On
or NoDecode
. Keep in mind that this may introduce unintended security issues, which this "feature" is designed to mitigate.
Apache的文档:<一href=\"http://httpd.apache.org/docs/current/mod/core.html#allowen$c$cdslashes\">http://httpd.apache.org/docs/current/mod/core.html#allowen$c$cdslashes
Apache docs: http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes
解决:
- 如果%2F是接收HTTP 400错误在JBOSS 的GET URL的一部分
- Receive an HTTP 400 error if %2F is part of the GET URL in JBOSS
这一次让我太 - 谢谢了问题。
This one got me too -- thanks for the question
这篇关于在URL休息%2F,根本不涉及到所需要的PHP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!