httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis GALIEGUE <>
Subject Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?
Date Fri, 04 Dec 2009 13:18:09 GMT
On Fri, Dec 4, 2009 at 14:07, André Warnier <> wrote:
> First, I believe that one mistake is to include the trailing question mark
> into the URL which you redirect.
> In
> The "?" is not actually part of the URI. It is a separator between the URI
> and the query string. So the URI to test is "/foo/", and not "/foo/?".
> Second, in "RedirectMatch", "RewriteCond" and "RewriteRule", the argument is
> a regexp, not a string. So when you write "/foo/?$", you mean actually :
> "/foo", possibly followed by "/", followed by the end of the string.
> If you really wanted to test for a "?", you would have to escape it as "\?".
> I do not know if this is the source of your particular problem, but it may
> contribute to the strange results which you are seeing later.

No, the ? is intended, I want to match either /foo or /foo/, so
^/foo/?$ is the correct regex, I'm sure about that.

The problem I have is with the & being systematically understood by
the right size of regexes to mean "the whole thing matched by the
matching left regex". While this is a common regex idiom in "basic"
regexes (sed acts this way for instance), it is not expected at all
from pcre (Perl doesn't know about &, and from what I've read about
pcre so far, pcre doesn't know about it either). Hence my puzzle.


Francis Galiegue
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
40 avenue Raymond Poincaré
75116 Paris

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message