How to force your site to use SSL (https) using cPanel

First of all, you will need to install an SSL certificate to your site - a guide on how to do this can be found here...

 

 

 

Once your certificate is installed, you will need to redirect from 'http://' to 'https://' - this can be achieved in a number of ways...

 

Force https:// via a .htaccess file

To force all web traffic to use HTTPS insert the following lines of code in the .htaccess file in your website's root folder. Important:If you have existing code in your .htacess, add this above where there are already rules with a similar starting prefix.

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://%{SERVER_NAME} [R,L]

Be sure to replace www.example.com with your actual domain name. To force a specific domainto use HTTPS, use the following lines of code in the .htaccess file in your website's root folder:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]

Make sure to replace example\.com with the domain name you're trying force to https. Additionally, you need to replace www.example.com with your actual domain name. If you want to force SSL on a specific folder you can insert the code below into a .htaccess file placed in that specific folder:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} folder 
RewriteRule ^(.*)$ https://%{SERVER_NAME}/folder/$1 [R,L]

Make sure you change the folder reference to the actual folder name. Then be sure to replace www.example.com/folderwith your actual domain name and folder you want to force the SSL on.

 

Force https:// using a WordPress plugin

There are tons of plugins available for this purpose, however, the one we recommend is called 'Really Simple SSL' - this can be downloaded in WordPress via the Plugins section of your Dashboard. One thing you will need to also do when setting https:// for your WordPress site is ensure your 'Site URL' in Settings -> General also have 'https://' in.

  • SSL, HTTP to HTTPS, SECURITY, TECHNICAL
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Server Transfer: Database Error (Nova)

After a server migration, it is possible for particular errors to occur that are beyond our...

Free SSL via cPanel (Let’s Encrypt™)

Installing an SSL certificate in cPanel is easy! Best of all, it's free with Utopia Host....

Check disk usage using cPanel

(cPanel >> Home >> Files >> Disk Usage) Overview This interface displays...

Change the size of images in a directory using cPanel

(cPanel >> Home >> Files >> Images) Image Scaler Click Image Scaler to...

Using the built in cPanel backup facility

(cPanel >> Home >> Files >> Backup) Overview The Backup interface allows you...

Powered by WHMCompleteSolution