How To Force HTTPS (SSL/TLS) On Your cPanel Domains Print

  • cpanel, ssl, https
  • 0

Nowadays HTTPS access to a website has become almost compulsory in order to meet security requirements.

The good news is that Farbyte's UK cPanel hosting gives you a FREE Comodo SSL/TLS HTTPS certificate to secure every domain, & sub-domain that you host with us.

However, by default, this will allow website visitors to access both the HTTP & HTTPS versions of every page on your website.

To force the use of HTTP only, you should place the following Apache rules in the .htaccess file located in the document root of your domain:


RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]


The above rules will allow HTTP access to 2 URL paths, which are required for cPanel and free SSL (HTTPS) to function, whilst ensuring HTTPS is used for all other URLs for the domain.


Was this answer helpful?

« Back