[unclug] Redirect 80 ---> 443 with Apache?

John W. Sopko Jr. sopko at cs.unc.edu
Fri Feb 20 09:37:47 EST 2004

Hey Jeff,

I have been trying to get this to work.
I am doing some web server upgrades/configurations, I am looking at
upgrading our apache servers to redhat enterprise 3/apache 2.x.
I may need the port 80 -> 443 redirection for a project I am working on.

I know I have gotten this mod_rewrite to work in the past on apache 1.3 
but cannot get it to work on a rhel3/apache 2.x server. You can take a 
look at the following link and see the mode_rewrite is turned on. I
configure a self-signed certificate on my ssl server so 
https://lark.cs.unc.edu works. I cannot get any redirection to work even 
if I do something simple like:

RewriteRule    ^/(.*) http://yahoo.com [L,R,NC]

I turned on rewrite logging and it does not log anything. I opened up 
server-info to .unc.edu so you should be able to see my config at:


Note I also see a problem with the server-info on rhel3/apache 2.x
where the core.c module does not fully list my configuration,
it cuts it off, but the mode_rewrite config is fully shown. Thanks
for any suggestions.


>> Thanks for all the replies.  For posterity, here's how you redirect 
>> all connections to an Apache server to SSL (https):
>> make sure mod_rewrite is loaded:
>> LoadModule rewrite_module modules/mod_rewrite.so
>> and add this to your httpd.conf file:
>> RewriteEngine  on
>> RewriteCond    %{SERVER_PORT}  !^443$
>> RewriteRule    ^/(.*)          https://%{SERVER_NAME}/$1 [L,R,NC]
>> Jeff
>> _______________________________________________
>> unclug mailing list
>> unclug at lists.ibiblio.org
>> http://lists.ibiblio.org/mailman/listinfo/unclug

John W. Sopko Jr.               University of North Carolina
email: sopko AT cs.unc.edu      Computer Science Dept., CB 3175
Phone: 919-962-1844             Sitterson Hall; Room 044
Fax:   919-962-1799             Chapel Hill, NC 27599-3175

More information about the unclug mailing list