RE: [users@httpd] unexpected RewriteRule behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[...]
> From: Rich Bowen [mailto:rbowen@xxxxxxxxxxx] 
[...]
> 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@xxxxxxxx 

[...]



---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux