Skip to content

How do I force SSL/HTTPS on my websites?

You can force visitors to use SSL/HTTPS by adding rewrite rules to your site’s .htaccess file.

cPanel allows you to automatically redirect all traffic on a domain from HTTP to HTTPS through its Domains interface.

  1. Log in to your cPanel account.

  2. Navigate to the Domains section and click on Domains.

    Domains in cPanel

  3. Turn on Force HTTPS Redirect

    Force HTTPS Redirect

    cPanel also allows you to force HTTPS redirects across multiple domains at once using the checkbox on each domain and the Enable Force HTTPS Redirect button.

Add this rule to your .htaccess file:

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

Replace domain.com with your actual domain name:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com [OR,NC]
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]