Redirect non-SSL to SSL in Linux (Apache)

Create a file .htaccess in the document root of your site with the following code.  If this file already exists, append the following code to it: 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </IfModule>
Was this answer helpful? 0 Users Found This Useful (0 Votes)