httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael D. Berger" <m.d.ber...@ieee.org>
Subject RE: [users@httpd] unexpected RewriteRule behavior
Date Tue, 01 Nov 2005 22:22:58 GMT
[...]
> From: Rich Bowen [mailto:rbowen@rcbowen.com] 
[...]
> Michael D. Berger wrote:
> > The following:
> 
> >    RewriteCond %{REQUEST_URI} !^.*/picts/.*$
> >    RewriteRule ^/(.*/)?$ /index.cgi [L]
> > 
> > sends
> >    GET /favicon.ico
> > to index.cgi .  I would not expect this because it
> > does not appear to match any pattern.  Wherein do
> > I err?
> 
> The REQUEST_URI is /favicon.ico, and this matches 
> !^.*/picts/.*$ - that
> is, it's a string that doesn't contain /picts/ anywhere in it.
> It also matches the RewriteRule pattern ^/(.*/)?$ because it 
> starts with
> a slash, and doesn't contain the optional "something followed 
> by a slash".
> So, according to this ruleset, it's supposed to rewrite that 
> to /index.cgi
> 
> So it seems that it's doing exactly what you asked for it to do.
> 
> The real question is what you're trying to do with this 
> rewrite ruleset,
> since that's not really evident.

The picts line is functioning as expected.  Such lines are
handled differently elsewhere. With regard to the RewriteRule
line, this is functioning correctly only of you ignore the
'$' end-of-line anchor.  From a linux box:

   echo // | grep -P "^/(.*/)?$"
   //
   echo / | grep -P "^/(.*/)?$"
   /
   echo /x.y | grep -P "^/(.*/)?$"
   echo /x.y/ | grep -P "^/(.*/)?$"
   /x.y/

Notice the one line that doesn't echo.  BTW, this is exactly
what I am trying to do.  The question is why the difference
between grep -P and RewriteRule?  I have yet to follow the
advice in another response and turn on logging.

Mike.
--
Michael D. Berger
m.d.berger@ieee.org 

[...]



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message