Re: rewriting http --> https not working

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

 



On 7/27/05, Ankush Grover <ankush174@xxxxxxxxx> wrote:
> > > # Rewrite Rules.
> > > RewriteEngine On
> > > RewriteCond %{HTTPS} !=on
> > > RewriteRule ^/webmail/(.*) https://%{SERVER_NAME}/webmail/$1 [R,L]
> > > RewriteRule ^/mailman/(.*) https://%{SERVER_NAME}/mailman/$1 [R,L]
> > >
> > > #Debug rewrite rules
> > > RewriteLog /etc/httpd/logs/rewrite_engine_log
> > > RewriteLogLevel 3
> > > -------
> > > The idea is to take any URL under /webmail or /mailman and redirect it
> > > to https, so that, for example,
> > >
> > > http://www.concretecomputing.com/webmail/
> > >
> > > gets redirected to the same page, but using https. It doesn't happen.
> 
> 
> <VirtualHost 192.168.1.46:80>
>         ServerName localhost
>         DocumentRoot /var/www/html
>         DirectoryIndex index.html index.shtml
>         RewriteEngine   on
>         RewriteCond     %{SERVER_PORT} ^80$
>         RewriteRule     ^/webmail(.*)$ https://192.168.1.46/webmail$1 [L,R]
>         RewriteLog      "/var/log/httpd/rewrite.log"
>         RewriteLogLevel 4
> </VirtualHost>
> 
> 
> Replace ipaddress either with the fqdn or with the ipaddress of your machine.
> 
> I am also attaching the ssl.sxw file in which how to generate
> certiticates for http.

Thanks to everyone for the help so far. Nothing has worked. My
/etc/httpd/conf.d/force-ssl.conf file is now:
----
# Rewrite Rules.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/webmail/(.*) https://%{SERVER_NAME}/webmail/$1 [R,L]
RewriteRule ^/mailman/(.*) https://%{SERVER_NAME}/mailman/$1 [R,L]

#Debug rewrite rules
RewriteLog /etc/httpd/logs/rewrite_engine_log
RewriteLogLevel 9
----
I didn't change the RewriteRule lines because:

1) Patrick's first suggestion, to remove the initial slash, shouldn't
matter and in fact didn't change anything in testing.
2) %{SERVER_NAME} covers Ankush's suggestion about using ip or fqdn;
if that part wasn't working I'd be getting redirected to the wrong
place, but I'm not getting redirected anywhere.
3) Todd Wease's suggestion is nearly identical to what I have already.
He left out a trailing slash in the pattern to match, but I've tried
typing URLs both with and without the slash and it doesn't make a
difference. His RewriteCond is equivalent to mine in my case where
http runs on 80 only, and https on 443 only.

I did increase the RewriteLogLevel, but there no entries ever show up
in that log file.

I have tried removing the "RewriteCond %{HTTPS} !=on" line, just in
case, but that didn't make any difference.

I checked /etc/httpd/conf/httpd.conf and found the line "LoadModule
rewrite_module modules/mod_rewrite.so" so that's good.

It was great of Ankush to send ssl cert instructions, but I already
have that working; SSL is not the issue.

So what's going on here? As far as I can tell, mod_rewrite is just not
doing what it has been told to do. It's like it's not even watching.

Thanks again,
Matt


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux