How to redirect HTTP traffic to HTTPS using an htaccess file

The below code when added to an htaccess file will automatically redirect any traffic destined for http: to https:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
  • cpanel, htaccess redirect, redirect
  • 42 Users Found This Useful
Was this answer helpful?

Related Articles

How to check PHP version and configuration

Login to your cPanel Locate Software Tab and click PHP Version Select to increase or decrease...

What is an index page?

The index page is the URL or local file that automatically loads when a web browser starts and...

MySQL Database Access Outside of cPanel

There is no way to grant permission to just MySQL or phpMyAdmin. You can have them access the...

Disk Space and Bandwidth Usage

Disk Space Usage Log in to your cPanel Navigate to the Files section on the cPanel. Click...

cPanel Email: How to Mass Delete Emails

By using webmail you can quickly remove email from an entire folder from your account or you can...