Problem with the lack of url encoding in the rewrite result url

Hi everyone!

Recently we’ve moved from lighttpd to nginx and I’ve discovered a
with the different rewrite handling in nginx.

The rule:

rewrite ^/download/([^/]+)/(.+)/$
/index.php/download/?hash=$1&filename=$2 last;

works fine, but the $1 and $2 args in the result url are not url encoded
sometimes we have “&” in the filenames which brakes the resulting query
string by cutting the file name and adding another variable. Encoding &
%26 in the source url doesn’t help. Is there a way to enable url
encoding of
the args for the result url?

Alexander Radostin