I need to pass / as a variable as part of a URL.
My structure looks like this:
http://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 fromApachefor security purposes.You may modify Apache config to enable
AllowEncodedSlashes OnorNoDecode. 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:
This one got me too — thanks for the question