You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Vern Hart <v-...@vern.com> on 2001/02/03 01:43:28 UTC

backreferences aren't being expanded for internal RewriteMaps

I just upgraded from 1.3.12 to 1.3.17 and am having trouble using
backreferences that used to work:

    RewriteMap lowercase int:tolower
    RewriteCond ${lowercase:%{SERVER_NAME}} ^(www\.)?(.+)$
    RewriteCond %{DOCUMENT_ROOT}/%2         -d
    RewriteRule ^/(.*)$                     %{DOCUMENT_ROOT}/%2/$1

The "%2" is being replaced with "${lowercase:www.barracuda.com}"
instead of "barracuda.com".

I searched the bugs list and found one that looked very similar
(PR6671) so I tried the test case mentioned:

    RewriteMap test int:toupper
    RewriteRule (.*)        ${test:$1}

And that fails as well.

Here's what my rewrite log says (eliminating date etc.):

    [rid#83c3c84/initial] (2) init rewrite engine with requested uri /foo
    [rid#83c3c84/initial] (3) applying pattern '(.*)' to uri '/foo'
    [rid#83c3c84/initial] (2) rewrite /foo -> ${test:/foo}
    [rid#83c3c84/initial] (2) local path result: ${test:/foo}

So, instead of changing "/foo" to "/FOO" it changes it to
"${test:/foo}".

The bug report PR6671 says the problem was fixed in October on
1.3.14.  Looking at mod_rewrite.c, the source has changed a little
since then so I can't tell, with a quick glance, what the
functionality of the changes is.  The patch is in
http://httpd.apache.org/dist/apache_1.3.14-fix.diff

Can I get a sanity check?  Can someone verify this is a problem with
their 1.3.17?

Thanks,
Vern