How to force redirect over HTTPS

In order to force your web traffic to use HTTPS, edit the codes in the .htaccess file.

For information on how you can edit your .htaccess file click here

 

To redirect all web traffic:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.YOUR-DOMAIN-HERE/$1 [R,L]

(Replace "Your-Domain-Here" text with your Domain Name)

 

To redirect traffic to a specific directory:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.YOUR-DOMAIN-HERE/YOUR-DIRECTORY-NAME-HERE/$1 [R,L]

(Replace "Your-Domain-Here" text with your Domain Name and "Your-Directory-Name-Here" with the name of your directory / sub folder)

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Generate a Certificate Signing Request - CSR in cPanel

Obtaining a certificate from a trusted SSL provider requires a Certificate Signing Request (CSR)....

How to Retrieve a CSR from cPanel

Have you generated a Certificate Signing Request (CSR) from cPanel but lost it? Then, you can...

How to Remove a CSR code in cPanel

You can remove the CSR code, which is no longer needed. Please, keep a backup of the CSR code for...

How to Install an SSL on Your Domain Using AutoSSL in cPanel

cPanel can automatically install an SSL on your domain within a few hours. However, even after 24...

Powered by WHMCompleteSolution