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.
- Open "Domains".
- In the domain row, switch "Force HTTPS Redirect" on.

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://.