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

Joe Morris morris at unc.edu
Fri Feb 20 09:53:43 EST 2004

On Fri, 20 Feb 2004, John W. Sopko Jr. wrote:

| 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 have no idea what the R and NC options are for.  L should be all you
need.  Are you sure you don't have an infinite loop here?

Using mod_rewrite is complete overkill for a simple redirect.  Using the
following is much simpler and is in the core of Apache.  You will need to
have a virtual host setup for port 80 and make sure this statement only
exists in that stanza (otherwise, it will be applied globally and you
setup an infinite loop--not good).

  Redirect permanent .* https://newlocation.com

Joe Morris, Web Systems Manager
Academic Technology and Networks
The University of North Carolina at Chapel Hill

More information about the unclug mailing list