> -----Original Message-----
> From: Rich Bowen [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 01, 2005 7:24 PM
> To: users@httpd.apache.org
> Subject: Re: [EMAIL PROTECTED] unexpected RewriteRule behavior
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Michael D. Berger wrote:
> > [...]
> > 
> >>From: Rich Bowen [mailto:[EMAIL PROTECTED] 
> > 
> > [...]
> > 
> >>Michael D. Berger wrote:
> >>
> >>>The following:
> >>
> >>>   RewriteCond %{REQUEST_URI} !^.*/picts/.*$
> >>>   RewriteRule ^/(.*/)?$ /index.cgi [L]
> 
> ...
> 
> > 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 "^/(.*/)?$"
> 
> That's correct. It doesn't match, because the (.*/) is optional, and
> when it's *not* there, then the regex is equivalent to ^/$ - ie, it
> insists that it ends with the slash, which this string does not do.
> 
> >    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.
> 
> I'm sorry, it's still not clear what you're trying to accomplish with
> these rules. Can you state in words what the rules are 
> supposed to solve?
> 
> - --
> Rich Bowen
> [EMAIL PROTECTED]

What the rules are "supposed to solve" is not relevant to this
discussion. This is what they are >supposed to do<.

Do not change anything with "picts" in it.

For the rule above:
Change to /index.cgi for:
   /
   anything that both begins and ends in "/", i.e. "/.*/"

The other rule, not shown here, was incorrect.  The corrected version is:
   RewriteRule ^/.*\.html(\?.*$)? /index.cgi$1 [L]

This will call /index.cgi for any URL that begins in "/", ends in ".html",
and optionally has argumenmts following a ?.  If there are arguments,
they will be passed to index.cgi.

Perhaps there is difficulty because it is not obvious why I would want
to do this.  Suffice it to say that index.cgi is rather complex.

Mike.
--
Michael D. Berger
[EMAIL PROTECTED] 

[...]



---------------------------------------------------------------------
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: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to