httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 45529] New: B flag in mod_rewrite RewriteRule doesn't escape & and other sim characters
Date Sun, 03 Aug 2008 15:59:55 GMT

           Summary: B flag in mod_rewrite RewriteRule doesn't escape & and
                    other sim characters
           Product: Apache httpd-2
           Version: 2.2.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_rewrite

In Apache 2 documentation for mod_rewrite a new B flag is supposed to not
unescape back references, see:

When I'm trying this on my testpage in Apache 2.2.9, Apache fails doing just
that, which the above example from mod_rewrite's documentation states that it
should. That is, C++ or C%2B%2B becomes in the querystring C++ and not C%2B%2B.
The same with a&b or a%26b which becomes a&b and not a%26b. For some characters
it works: a%23b becomes a%23b.

This is essential when making rewrite rules for the MediaWiki, which should be
able to have pagenames with & and other similar characters in it. Now if an &
character appears, it is interpreted as a variable separator in the URL. The B
flag should, according to the documentation above, take care of this problem,
but it doesn't.

Try it yourself on my test page, and change teststring in the URL below to
whatever string you like:

So you know what code you are testing against, the test page contains the
following files, a .htaccess file and an index.php file:

RewriteEngine On
RewriteRule ^abc/(.*)$ /~marten/test/index.php?show=$1 [B]


if ($_GET['show'])
echo("_GET['show']: " . $_GET['show'] . "<br>");

echo("_SERVER['QUERY_STRING']: " . $_SERVER['QUERY_STRING'] . "<br>");

if ($_GET['show2'])
echo("_GET['show2']: " . $_GET['show2'] . "<br>");

$test_var = "<br>Some special characters like &, % and some escaped %2B and %26
et.c. works fine in a normal PHP string variable.";

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message