How to force HTTPS in cPanel

When the domain has a valid SSL certificate (how to get one), turn on the redirect so the site always opens over https.

  1. Open "Domains".
  2. In the domain row, switch "Force HTTPS Redirect" on.
Force HTTPS Redirect switch
Force HTTPS Redirect switch

The switch is unavailable until the domain has a valid certificate. Aliases have no switch - they follow the main domain.

With .htaccess

For a custom rule (for example, https and no www at once), add this to the top of .htaccess in the site folder:

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

Replace example.com with your domain. Do not use the switch together with a similar rule in the CMS or a plugin - you may get an endless redirect.

In WordPress, after turning on https, change the site address: "Settings" -> "General", "WordPress Address" and "Site Address" - to https://.

Questions and answers
The domain has no valid SSL certificate yet. Wait for AutoSSL.
The redirect is on in two places: in cPanel and in the CMS, a plugin or .htaccess. Keep only one.