How to force SSL with .htaccess Print

  • 1194

 

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.


Was this answer helpful?

« Back