How to force SSL with .htaccess

This guide will advise you on how to force SSL connections via the .htaccess file.

Step 1:
Find and edit the .htaccess file. It will be in the root directory of your website / FTP.

Step 2:
Add the following code to the top of the .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Lets Encrypt SSL

We offer free, automatic SSL installation through Lets Encrypt.A cron job runs every night to...