How do I force my website to use HTTPS instead of HTTP?

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

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

The .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.