How to force a site to use SSL (HTTPS://)
We all want to stay safe on the internet and it's easier to do so when SSL (Secure Sockets Layer) is in use. SSL ensures that all communications between your web browser and the site you are visiting is encrypted. Sites using SSL will usually show a green or secure/locked padlock at the start of your browsers address bar.
This article shows you how to have the webserver force all connections to your site over SSL, this means all connections will be made using https:// instead of http://. Keeping your information safe from hackers.
-
To force SSL connections to a site edit the
.htaccessfile in the folder containing the site. You can do this through cPanel File Manager or via FTP (download the file, edit it and upload again).
Add the following lines to the top of the.htaccessfile
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]-
After saving the file, try visiting your website using an http:// URL - you'll find that it gets redirected to the https:// version.