Skip to Content.
Sympa Menu

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

unclug AT lists.ibiblio.org

Subject: UNC Linux Users Group

List archive

Chronological Thread  
  • From: "John W. Sopko Jr." <sopko AT cs.unc.edu>
  • To: UNC Linux Users Group <unclug AT lists.ibiblio.org>
  • Subject: Re: [unclug] Redirect 80 ---> 443 with Apache?
  • Date: Fri, 20 Feb 2004 10:01:13 -0500

The NC is for No Case (case insensitve match), the R is required if
you redirect back to your own site using a http:// URL, (very cryptic, I had to look this up, then again mod_rewrite is pretty cryptic), the L
is to tell mod_rewrite this is the last rule to process. The
rule:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L]

should not cause a loop, if coming in on port 80 it should
re-direct to 443 and coming in on 443 will make the match
false and skip the RewriteRule.

Joe Morris wrote:

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
_______________________________________________
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





Archive powered by MHonArc 2.6.24.

Top of Page