Knowledgebase: cPanel Web Hosting
Redirect to HTTPS on cPanel (Redirect HTTP to HTTPS automatically)
Posted by LankaHost NOC on 23 February 2017 07:55 AM

In cPanel, you can redirect all your web site traffic to HTTPS through .htacces file. Here are the steps to get it done. 

 

Step 1 :

Log-in to the cPanel and navigate to file manager, public_html folder

 

Step 2:

If there is .htaccess file, open it using a text editor in file manager.

    ** If there is no any .htaccess file, you can create a new file and name it as .htaccess

 

Step 3:

Add following line on top the .htaccess  file

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

 

Notes :

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

 

Hint :

If you are unable to see .htaccess file in your cPanel public_html folder (even you create one), you need to enable 'Show hidden file' option in your cPanel

1. Click on settings icon in your cPanel file manager,

2. Enable the option 'Show hidden file'

 

(15 vote(s))
Helpful
Not helpful

Comments (6)
tharshan
03 March 2017 02:41 PM
helpfull
Rohan Krishantha
24 April 2017 07:36 AM
Hi ,
Thank yoy verymuch this is very helpful post
Best regards,
Rohan Krishantha
www.cdesignlk.com
GeneralDesigns
25 April 2017 07:10 AM
awesome service!
Channa
17 March 2018 09:39 AM
Thank you very much for simplifying hard work in very smart way!
Yasas Perera
26 March 2018 05:08 AM
thank you. great guide!
Dilhan
05 May 2018 12:59 PM
Thanks. simple and clear.
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).