Redirect HTTP to HTTPS in cPanel

Overview

In this article we will show you how to Redirect HTTP to HTTPS in cPanel, if you have an SSL certificate on your website, you can automatically forward visitors to the secure version (HTTPS) of your site for a secure connection. There is a simple tool in the panel that will help you achieve this, we'll explain it in this lesson.

Enforcing SSL for the main domain

In this article we will show you now how to redirect HTTP to HTTPS in the primary domain cPanel:

  1. Log in to your cPanel account.
  2. From the Domains menu, click Domains
  3. This will open a page where you can toggle the HTTPS redirect on or off.
  4. Ensure that you have installed SSL and the option to Run appears.
  5. Your domain name is now running with an SSL certificate.
Note

We recommend leaving it on. If there is no option to enable HTTPS, it's because that domain does not have SSL installed. First, make sure SSL is installed and the option will present itself.

redirects visitors to the HTTPS version of your site

Linux uses .htaccess files to handle redirection. You may need to create a .htaccess file, and you can use your control panel's File Manager. Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your site:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
If you have an existing .htaccess file:

  • Do not duplicate RewriteEngine On.
  • Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On.

Share this:
FacebookTwitterWhatsAppViberCopy LinkTelegramLinkedIn
Updated on July 6, 2020
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support