After installing an SSL certificate, your website is available over HTTP and HTTPS. However, it’s better to use only the latter because it encrypts and secures your website’s data. While there are various methods to force your website to load via https, using the .htaccess file to force HTTPS connection is quite standard and recommended.

You can activate the feature to force HTTPS on all incoming traffic by following these steps:

  1. Login to cPanel
  2. Go to File Manager in your hosting account and open .htaccess inside the public_html folder. If you can’t locate the .htaccess , click on settings at the top right of your account and check ‘show hidden files(dotfiles)‘. If the file does not show, simply create it.
  3. Edit the file. When the editor screen opens, add the following code to the file;

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

If using WordPress and you want all pages to use https, also do the following:

You can do this by going to Settings » General and updating both your WordPress and site URL address fields. Simply update the URL from HTTP to HTTPS

LEAVE A REPLY

Please enter your comment!
Please enter your name here