URL decode rewrite handling: + vs. %20

signe nginx-forum at nginx.us
Sat Sep 3 10:32:29 UTC 2011

splitice Wrote:
> edit the php script to do something like this
> before the rest of the script
> $_GET['g2_path'] = urldecode($_GET['g2_path'])
> ?

That's not the problem - query parameters are automatically decoded by
PHP before processing even begins.  nginx is turning a + (space) into a
%2b (plus).  Once it's handed off to the application, it can't tell the
difference between a filename that actually had a +, and one that was
converted by nginx.  It needs to happen before it's handed off to

I've already modified G2 to present URLs which are more accurately
encoded, but that doesn't resolve the issue since these URLs have been
published for years.  They're in search engines, blog posts, etc.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,214668,214687#msg-214687

More information about the nginx mailing list