Redirect my cPanel website to HTTPS


After your SSL certficate is installed on your Linux Hosting account, there are some modifications you'll need to make to your .htaccess file. Adding a few lines to your .htaccess file will automatically redirect your visitors to the HTTPS version of your website.

  1. Go to your Heart Internet customer area and select cPanel Hosting.
  2. Select the your desired cPanel hosting account and select Login.
  3. In the account Dashboard, click File Manager.
  4. In the cPanel File Manager, click Settings.
  5. Make sure that Show Hidden Files (dotfiles) is checked, and click Save.
  6. Click on public_html, and open your .htaccess if you already have one. If not, click File+, name the file .htaccess and click Create New File.
  7. Select the .htaccess file, and click Edit.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.com
RewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]

Required: You need to replace coolexample.com with your domain name for the sample code to work.

  1. Click Save Changes and Close. That's it!

Visit your website and you'll automatically be re-directed to the HTTPS version.

We provide these instructions as a courtesy, but you may need to make other changes to get the redirect working if you already have a .htaccess file.



Article ID: 873
Created On: Wed, Jun 3, 2020 at 10:35 PM
Last Updated On: Wed, Jun 3, 2020 at 10:35 PM

Online URL: https://www.heartinternet.uk/support/article/redirect-my-cpanel-website-to-https.html