Redirect HTTP TO HTTPS Automatically

If you need to create a .htaccess file, you can use your control panel's file manager.

Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your site:

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

If you have an existing .htaccess file:

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

Was this answer helpful?

 Print this Article

Also Read

MySQL database not showing in cPanel

If database is not showing in cpanel, make sure database exists in the server. If it exists, make...

How Can I See My Total Disk Space and Bandwidth Available on My Reseller Account?

If you would like to check the number of files, disk space or how much bandwidth you are using on...

.htaccess Tutorial

Summary In this tutorial you will find out about the .htaccess file and the power it has to...

How to whitelist your IP at CPHulk

IF IP got banned by CPHulk few times and it is really not a pleasant thing knowing that you need...

How do I backup my entire site in cPanel?

Entire accounts can be backed up by doing the following: Go to 'backup', under the 'Site...