Bryan Seeds


Apache Redirect HTTP to HTTPS

This article explains how to redirect a HTTP request to HTTPS so you ensure your visitors are always using an SSL enabled connection with the Apache web server.  This requires first that you have in your httpd.conf configuration file the SAPI module "mod_rewrite" un-commented and working, and of course that you have mod_ssl working also.  Then all there is to it is create an ".htaccess" file in your servers document root.  The file should contain the below :

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

Also, there is another method.  Simply append to your httpd.conf file these lines :

Redirect permanent /

Hope that is of some help to some of you.

Tagged as: , , No Comments