Redirect my cPanel website to HTTPS
Once you’ve installed your SSL certificate on your Hosting account, you’ll need to make some changes to your .htaccess file so that it automatically redirects visitors to an HTTPS version of your site.
Please note: this process applies to Web Hosting plans purchased after July 2020 and Premium Hosting plans purchased after August 2020 (cPanel).
Select File Manager in the account dashboard.
Select Settings from the cPanel File Manager in the top-right corner.
Ensure that the Show Hidden Files (dotfiles) option is checked, and select Save.
Double-click public_html from the File Manager dashboard.
Select your .htaccess file and click Edit.
If you don’t have a .htaccess file, click File+, name the file .htaccess and click Create New File.
On the pop-up menu that appears, click Edit.
If you already had a .htaccess file, you’ll need to insert the following code into it:
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.co.uk
RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R,L]
Be sure to replace example.co.uk with your own domain name though!
If you had to create a new .htaccess file, you’ll need to insert the following code into it:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.co.uk
RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R,L]
Again, make sure that example.co.uk is replaced with your own domain name.
Once done, select Save Changes, followed by Close in the top-right corner.