unclug AT lists.ibiblio.org
Subject: UNC Linux Users Group
List archive
- From: "John W. Sopko Jr." <sopko AT cs.unc.edu>
- To: Jeff Bollinger <jeff01 AT email.unc.edu>
- Cc: unclug AT lists.ibiblio.org
- Subject: Re: [unclug] Redirect 80 ---> 443 with Apache?
- Date: Fri, 06 Feb 2004 12:36:54 -0500
Another handy redirect method if you only want certain directories that
need to go to the https server is to configure a .htaccess file in the
directory like:
<IFDefine INSECURE>
RedirectMatch (.*)$ https://www.cs.unc.edu$1
</IFDefine>
This requires you specify a "-DINSCURE" option to the http server on startup (httpd -DINSECURE). I run my secure
web server with a "-DSECURE" define and my insecure with a "-DINSECURE" define. You can then do the following in a .htaccess file:
<IFDefine INSECURE>
RedirectMatch (.*)$ https://www.cs.unc.edu$1
</IFDefine>
<IFDefine SECURE>
AuthUserFile /var/www/.htpasswd
AuthName 'Computer Science UserID:'
AuthType Basic
Satisfy any
order deny,allow
deny from all
allow from .cs.unc.edu
require valid-user
</IFDefine>
If you access the page on the INSECURE server it redirects you
to the SECURE server which in turn lets you in if you are in the domain
else prompts you for a password. You can use all or parts of this. I have an explanation at:
http://www.cs.unc.edu/help/www_server_faq.html#Question10
Jeff Bollinger wrote:
Jeff Bollinger wrote:
I am setting up an Apache 2.0.48 webserver and when anyone makes a request to http://sitename, I want it to automatically redirect to https://sitename. Do I have to use mod_rewrite for this, or can I just alter some other directive (Listen??)
Thanks!
Jeff
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
-
[unclug] Redirect 80 ---> 443 with Apache?,
Jeff Bollinger, 02/06/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
Jeff Bollinger, 02/06/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
John W. Sopko Jr., 02/06/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
John W. Sopko Jr., 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
Jeff Bollinger, 02/20/2004
- Re: [unclug] Redirect 80 ---> 443 with Apache?, John W. Sopko Jr., 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
Joe Morris, 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
John W. Sopko Jr., 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
Joe Morris, 02/20/2004
- Re: [unclug] Redirect 80 ---> 443 with Apache?, John W. Sopko Jr., 02/20/2004
- Re: [unclug] Redirect 80 ---> 443 with Apache?, Joe Morris, 02/20/2004
- Re: [unclug] Redirect 80 ---> 443 with Apache?, John W. Sopko Jr., 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
Joe Morris, 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
John W. Sopko Jr., 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
Jeff Bollinger, 02/20/2004
- Re: [unclug] Redirect 80 ---> 443 with Apache?, John Reuning, 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
John W. Sopko Jr., 02/20/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
John W. Sopko Jr., 02/06/2004
-
Re: [unclug] Redirect 80 ---> 443 with Apache?,
Jeff Bollinger, 02/06/2004
Archive powered by MHonArc 2.6.24.