To successfully do this, a special piece of code should be added to the web-site’s .htaccess file, which can be found in the root folder of a specific site in cPanel (e.g. “public_html”). If the file is not shown, please make sure to click on ‘Settings’ and tick the option ‘Show hidden files’. Also, this file can be created if it cannot be located in any way.

You can force an HTTPS connection on your website just by pasting this piece of code in your .htaccess file:



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