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?

For obtaining a certificate from a Trusted SSL Provider, the Certificate Signing Request(CSR) is...

How to retrieve an CSR from cPanel?

If you generated your Certificate Signing Request (CSR) from cPanel and forgot your CSR then you...

How to Remove a CSR code from cPanel?

When you generate a Certificate Signing Request (CSR) from cPanel, then save it, which is a good...

How to run AutoSSL on your Domains to install an SSL via cPanel?

If your domain is created recently, wait for a few hours so that the cPanel can automatically...

How to Include or Exclude a Domain from AutoSSL in cPanel?

You can include or exclude your domain from AutoSSL.If your domain is newly created, wait for...

Powered by WHMCompleteSolution