Knowledge Base

Get Expert Website Hosting

Choose website reliability and expertise with SiteGround!

Home / Website Help / SSL Issues / How to force SSL with .htaccess?

How to force SSL with .htaccess?

Last update: Oct 08, 2025

To force the HTTPS connection on your website, add the following lines inside the website’s .htaccess file:

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

 

Share this article