Monday, November 8, 2010

Apache redirect all http (80) to https (443)

Add 2 ports to listen on in http.conf:

Listen 443
Listen 80

Then, in the vconf.d dir, set this for the virtual host on port 80:


   RewriteEngine   on
   RewriteCond     %{SERVER_PORT} ^80$   
   RewriteRule     ^(.*)$ https://%{SERVER_NAME}$1 [L,R]


Updated!!!

Instead of redirecting everything, only sensitive material is sent through https. The
SSLRequireSSL
directive is placed within Directory or Location of relevant
files in /etc/httpd/conf/webapps.d ( maybe also in /etc/httpd/conf.d)

No comments: