[unclug] Redirect 80 ---> 443 with Apache?
John W. Sopko Jr.
sopko at cs.unc.edu
Fri Feb 20 10:18:37 EST 2004
Yes, you can see the config at:
http://lark.cs.unc.edu/server-info#mod_rewrite.c
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L]
RewriteLog /tmp/rewrite.log
RewriteLogLevel 9
I am searching the web now, I found this, someone else is
having the same problem in apache 2.x:
------------
I'm looking for a method to do the same thing.
(http://www.abc123.com => https://www.abc123.com). This one works for me
in Apache 1.3, but not in 2.0:
RewriteEngine on
RewriteRule ^/(.*) https://www.abc123.com/$1 [R]
Am I missing something in Apache 2.0 (quite new to that..), or has the
mod_rewrite syntax changed?
Suggestions very welcome!
TIA,
Dirk
Joe Morris wrote:
> On Fri, 20 Feb 2004, John W. Sopko Jr. wrote:
>
> | 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.
>
> Do you have the following as well?
>
> RewriteEngine On
>
> What is SERVER_NAME set to? May want to just force that to the web site
> name to avoid any confusion there. Don't have to worry about that NC
> option as there as you are not comparing any such strings.
>
> _______________________________________________
> 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
More information about the unclug
mailing list