Forum: NGINX rewrite URI include "&" problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
lhmwzy (Guest)
on 2009-02-04 18:06
(Received via mailing list)
I have a rewirte rule:
                if (-f $request_filename ) {
                        rewrite ^/(.*/)(.*)$
/file.php?path=$1$2&filename=$2 last;
if a URI include "&",the file.php will not function normally.
For example:
request /1&2/test.txt
the php file file.php will return "$path=1" and "$file=test.txt"
the correct is "$path=1&2/test.txt" and "file=test.txt"

How to resolve this problem?
Olivier B.valet (Guest)
on 2009-02-04 18:22
(Received via mailing list)

and if you correctly encode the "&", it doesn't work ? (function
rawurlencode() in PHP)

lhmwzy a écrit :
Igor S. (Guest)
on 2009-02-04 18:30
(Received via mailing list)
On Wed, Feb 04, 2009 at 11:58:56PM +0800, lhmwzy wrote:

> How to resolve this problem?

Currently no way.
nginx internally decodes %26 to "&" and does not escape captures.
This topic is locked and can not be replied to.