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]

.htaccess file needs to be located inside the site's document root folder. If your website is in a sub folder, then the .htaccess should be placed in the corresponding sub folder.
  • ssl, https
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

How to install free SSL ?

This KB Helps you how to fix the connection not secure error on your domain (How to install Free...