How to force HTTPS on your site

The installation of SSL certificate on a website allow access via HTTP and HTTPS. In this guide, a simple method to force HTTPS for the website instead of HTTP  is explained. Google recommend usage of HTTPS as encryption keep data transmission secure.

Prerequisite

  •   SSL Certificate ( which have been certified by CA authority)
  •   Control Panel access

Force HTTPS

  • Firstly find or create the .htaccess file, the redirection code will have to be entered on this file.
  • To force https add following lines in .htaccess file
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_POST}%{REQUEST_URI} [L,R=301]