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.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to create a cPanel user account?

To create a new cPanel account go to WHM >> Account Functions >> Create a New...

How can I limit the number of emails a domain can send out per hour?

Click on the "Tweak Settings" link under "Server Setup". Within the "Mail" section is a text box...

How can I limit access to certain directories on my server by requiring a password using cPanel/WHM?

In cPanel, it is very simple to limit access to a directory on your server. This can be used to...

How do I prevent SSL Certificate Warnings when accessing cPanel?

All cPanel servers come with self-signed certificates configured to secure the control panel as a...

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...

Powered by WHMCompleteSolution