On Tue, 2003-07-08 at 10:19, Rodolfo J. Paiz wrote:
> At 7/8/2003 07:18 -0400, you wrote:
> >>I have a website which must be served _only_ over HTTPS. However, I serve 
> >>pretty stupid users, so disabling port 80 is not ideal due to the 10 
> >>calls a day of "the site is down!". Rather, I want to redirect any and 
> >>all requests, for any URL on this site, to the very same URL but using 
> >>HTTPS. Below are the relevant parts of my httpd.conf:
> >><Directory "/var/www/apollo.paiz.org">
> >>     Options FollowSymLinks
> >>     AllowOverride All
> >>     RewriteEngine on
> >>     RewriteCond %{SERVER_PORT} !^443$
> >>     RewriteRule ^/(.*) https://apollo.paiz.org/$1 [R,L,NC]
> >>     Order allow,deny
> >>     Allow from all
> >></Directory>

I have this working.  Here is my rewrite section:


    #############################
    # Mod rewrite stuff
    #############################

    # rewrite environment
    RewriteEngine on
    RewriteLog /var/log/httpd/https_rewrite_log
    RewriteLogLevel 1

    # redirect http to https
    # If you don't try to access https, then redirect to https
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]

This is very close to yours.  The big difference is that I have it
in a VirtualHost block (server config) and you have it in a 
directory block.  The two are handled differently by mod_rewrite;
since you are really trying to do a server (virtual or real) redirect,
why not move it out of the directory block?

- rick warner


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to