How to force SSL with .htaccess

 

You can force an HTTPS connection on your website by adding these rules in your website's .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
The .htaccess file needs to be located inside the site's document root folder. If your website is in a subfolder, then the .htaccess should be placed in the corresponding subfolder.

You can create or edit the .htaccess file either via FTP, or using the File Manager available in cPanel.

  • 596 Users Found This Useful
Was this answer helpful?

Related Articles

Do you have Softaculous?

Yes, Softaculous is included with each Shared and Reseller hosting plan.Softaculous has over 300...

What are the nameservers?

The nameservers for our Shared & Reseller packages are as follows:ns1.shockhosting.com...

What are your server hardware specifications?

Below is a table of the server specifications that we use to power our services. Server hardware...

What are the account resource limits?

These are the resources that each cPanel account is limited to, these are in place to help...

Do you offer free SSL certificates?

We currently utilize AutoSSL from cPanel, this automatically installs free SSL certificates on...