After some experimentation and a suggestion from Ralf, I found the solution.
The explanation is interesting, so I thought it might be useful to post it
to the list:

1) Placing RewriteRule (or RewriteCond) within a <Location> scope means that
mod_rewrite is not invoked on the original URI, but rather on a file path
consisting of the DocumentRoot concatenated with the Location path.

2) The answer is therefore not to place rewrite directives within Location.
Once these were eliminated, the rule worked just as expected.

3) I found the RewriteLog facility excellent for seeing what was going on.
However, I did after to place the log and log level directives in each
VirtualHost in order to get output.  For some reason, placing these outside
the VirtualHosts doesn't work within them.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Ralf S. Engelschall
> Sent: Thursday, September 14, 2000 4:02 AM
> To: [EMAIL PROTECTED]
> Subject: Re: rewrite-rule problem for SSL redirection
>
>
> On Wed, Sep 13, 2000, Kirk Benson wrote:
>
> > This is slightly off-topic, but I'm sure I'm not the first to
> want to do the
> > following:
> >
> > I want all requests of the form http://server/ and https://server/ to be
> > redirected to https://server/login.jsp.  I have the following directives
> > within both my VirtualHosts
> >
> > <Location />
> > RewriteEngine On
> > RewriteRule /$ https://%{HTTP_HOST}/login.jsp [R]
> > </Location>
> >
> > This works fine, except that it also works for
> http://server/fubar/, i.e,
> > anything that ends with a '/'.  However, I can't find an expression that
> > matches the root URI.  I've tried "^/$", ^$", "^.?$" to no
> avail.  For some
> > reason, these result in a 302 return code.
>
> "^/$" is correct and should work fine. Try again this, please.
>
>                                        Ralf S. Engelschall
>

______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [EMAIL PROTECTED]
Automated List Manager                            [EMAIL PROTECTED]

Reply via email to