Real people, 24/7(800) 395-7779

How to Force HTTPS in cPanel Print

  • rewrite, https, SSL, redirect, htaccess, .htaccess
  • 1

Once your domain has an SSL certificate (included free through AutoSSL), you should send every visitor to the secure https:// address. There are two ways to do it.

First, check the certificate: In cPanel > Security > SSL/TLS Status, your domain and www should show a valid certificate. See How to Get an SSL Certificate Using AutoSSL. Forcing HTTPS without a valid certificate causes browser warnings.

Method 1: The Force HTTPS Redirect Switch (Easiest)

  1. Log in to cPanel:

  2. Open Domains:

    • In the Domains section, click Domains.
  3. Turn on the redirect:

    • Switch Force HTTPS Redirect to On for the domain. (The switch is only available once the domain has a valid certificate.)

Method 2: .htaccess Rules

Use this if you also want to choose www or non-www, or if your application needs the rule in its own .htaccess file.

  1. Open the .htaccess file:

    • In Files > File Manager, open your site's folder (usually public_html). If you don't see .htaccess, click Settings and check Show Hidden Files (dotfiles). If there is none, click + File and create one named .htaccess.
  2. Add the rules at the very top of the file:

    • HTTPS only (keeps whatever host the visitor typed):
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    • HTTPS and always www (replace example.com with your domain):
    RewriteEngine On
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]
    • HTTPS and never www:
    RewriteEngine On
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} ^www\. [NC]
    RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
  3. Save and test:

    • Click Save Changes and open http://yourdomain.com in a private browser window. It should land on the https address.

WordPress Notes:

Troubleshooting:

  • "Too many redirects": You probably have two redirects fighting (for example, Method 1 plus .htaccess rules plus a plugin), or Cloudflare is set to Flexible SSL. Use one method only, and set Cloudflare to Full (strict).
  • Site broke after editing .htaccess: Remove the lines you added and save; the site comes back immediately.

Need help? Open a ticket at https://my.peopleshost.com/submitticket.php and our support team will be glad to assist.


Was this answer helpful?

« Back