How to auto-redirect HTTP to HTTPS (SSL)

If you need to auto redirect all request from http to https (SSL) in Apache, add the following code to the top level .htaccess file.

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


 

Copyright © 2012 Kusumsiri. All Rights Reserved.