Saturday, November 27
Shadow

How to Redirect HTTP to HTTPS in cPanel?

cPanel is the most popular and used web hosting service in the world. By default, it provides the HTTP protocol for the hosted website. Even you installed the SSL certificate for the web site. while browsing it will browse the non-secure or HTTP. For the secure or HTTPS, you need to enter https:// example.com manually in the browser. But there are ways to redirect HTTP requests to the HTTPS request automatically.

cPanel http to https redirect page

As shows image above, you can enter the domain name with an HTTPS address for automatic redirection. Select the type of redirection, permanent (301) or temporary (302). In the second option select the single domain or main domain and subdomains if any. And, in the last table enter your domain name. Now you are done. But sometimes, it throws some error like; too many redirections.

If you encountered too many redirection issues. Go to the file section in the cPanel, open file manager. In the right corner of the page, there is a settings icon. Click on settings and select Show Hidden Files (dotfiles) and save it. Then you can see the .htaccess file on your home directory. If the .htaccess file is not there then create a new one. You need to edit that .htaccess file.

If you have the .htaccess file comment all lines and insert new lines or adjust lines accordingly. If you have created new one, insert these lines.

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

Below two images will help you to understand the steps,

Save and exit. Now, even you enter http://example.com it will redirect to the https://example.com automatically.
Please don’t forget to leave a comment.

Step by step video guide

28 Comments

Leave a Reply

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