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

What is the difference between Local, Backup, and Remote Mail Exchanger in cPanel?

These are options for the DNS zone for a domain in cPanel. Essentially, this tells cPanel how you...

How to host the primary domain from a subfolder (.htaccess)?

Summary The public_html directory for all of its Web site files. Addon domains use sub...

cPanel addon domain creation: ‘The domain already exists in the Apache configuration.’

Scenario: We might get an error when adding an addon or parked domain via cPanel. The domain...

How do I create a MySQL database and user in cPanel/WHM? How do I connect them?

To create a MySQL database and user, log into the cPanel interface for the desired domain and...

Webamail Access

How to log into webmail Webmail is a great feature offered by cPanel. You can access email from...

Powered by WHMCompleteSolution