How to force SSL with .htaccess
You are here:
< Back

You can easily force your website to load under HTTPS by using a .htaccess file.
This file allow you to define special rules for your web content to follow.

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.
This will usually be within the public_html folder.
If your website is in a sub folder, then the .htaccess should be placed in the corresponding sub folder.

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