%2F in URL breaks and does not reference to the .php file required [duplicate]
I need to pass / as a variable as part of a URL.
My structure looks like this: www.domain.com/listings/page-1/city-Burnaby+South/type-Townhome/bedroom-2/bathroom-2
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.
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.
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.
Urls with %2f /
or %5c \
return a 404 from Apache
for security purposes.
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 docs: http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes
Solved:
- Receive an HTTP 400 error if %2F is part of the GET URL in JBOSS
This one got me too -- thanks for the question