I get a 406 Not Acceptable error while having a URL similar to this:
www.example.com/search/find?q=YSBkZXJwIGZyb20gZGVycA~
and it seems to be due to the singular ~
character. I have to base64_encode()
it, using this function:
function base64_url_encode($string = null) {
return strtr(base64_encode($string), '+/=', '-_~');
}
Because the normal base64 encode generates an un-parseable URL.
I've had a look around and came across this answer: PHP/Apache Error:406 Not Acceptable
Which says to disable Mod_Security with:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
I know I'll have to probably find a different rewrite for the function above, but how could I fix this as to not receive the error again, if there is any way?
Instead of replacing =
characters with ~
, just remove them entirely. This is a common approach , and will not prevent values from being decoded.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.