Nginx will decode the characters in the URI and pass it to fastcgi, which is usually OK, but my search term contains a backslash and an encoded address.
Copy Code code as follows:
/search/madmanfoo%2flovesong/
Nginx Pass to PHP address becomes, I use pathinfo so can't get the correct result
Copy Code code as follows:
/search/madmanfoo/lovesong/
The Nginx official website to find all over and did not find to prevent the automatic decoding configuration, really do not want to two times code, from http://stackoverflow.com/questions/8264239/ Nginx-unescapes-2f-to-a-forward-slash-how-can-i-stop-it found a similar post, look at the sample can only two times encoded, it is said that the official advice. In order to preserve the beauty of the address, only two encodings of the backslash that affect pathinfo are made.
Copy Code code as follows:
$keyword =urlencode ($keyword);
$keyword =str_replace (Array ('%2f ', '%2f '), '%252f ', $keyword);
If there is a better solution, please correct me.