How to force SSL with .htaccess file ~ Ofuran

How to force SSL with .htaccess file

Learn how to force SSL with .htaccess file. You can force HTTPS connection on your website by adding these rules in your .htaccess file. At first install your SSL certificate in your website. 

Learn more - How to redirect https to http ?  



The .htaccess file should be kept on the site's root folder. Generally it locate here by default. Then write the following lines in that .htaccess file. 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

'