How to redirect http to https in cpanel

Firstly, ensure that you have the secure socket layer certificate (SSL) Certificate on your website before you can automatically redirect visitors to the secured (HTTPS) version of your site for a secure connection. You can CLICK HERE first to get one on a very good discount price.

To force http to https on cpanel, follow the below steps:

1) Login to your cpanel

2) Look for the Domains and click on it

3) Toggle the HTTPS redirect on if it is off. (NOTE: If there is no option to enable HTTPS, it’s because that domain does not have SSL installed).

If your site is still not redirecting to the https version or if you would like to enforce SSL for Addon domains, Please take note that Linux uses .htaccess files to handle redirection. So You may need to create a .htaccess file in your File Manager.

To do this:

Click on the File manager in your cpanel

In the public folder or in the folder of the site you would like to redirect the http to https version, check if there is .htaccess file, if not, create one by simply clicking on the File at the top of the page and enter the name .htaccess and hit create.

Open the .htaccess and copy and paste the following code in the file

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

Save and Close the file.

Congratulations! your site should be able to redirect to the https version of it.

Leave a Reply

Your email address will not be published. Required fields are marked *