rewriting http --> https not working
Matt Morgan
minxmertzmomo at gmail.com
Wed Aug 3 17:06:36 UTC 2005
On 7/27/05, Ankush Grover <ankush174 at gmail.com> wrote:
> On 7/27/05, Matt Morgan <minxmertzmomo at gmail.com> wrote:
> > On 7/27/05, Ankush Grover <ankush174 at gmail.com> 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.
> >
> > .
> > 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.
> > >
> > 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.
> >
> <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>
>
> The code given by me is running on 2 servers in my network.We have few
> applications of our own and I have done the rewriting rules for
> those.Most important it is working for webmail in my domain.
>
>
> It will be good if you can attach your httpd.conf file
Ankush, I didn't mean to say there was anything wrong with what you
sent. Only that it's almsot exactly what I was doing, and it wasn't
working for me.
I finally switched to using RedirectMatch instead of RewriteRule. That works.
Thanks, everyone.
More information about the fedora-list
mailing list