How to force HTTPS on your website using .htaccess

Modified on Sat, 16 Oct 2021 at 10:47 AM

As a safety precaution, we advice everybody to use SSL on their websites. You can use our free integrated Let's Encrypt SSL certificates for this. Enforcing SSL can be done by creating a .htaccess file in the document root (e.g. /domains/domain.com/public_html) with the following contents:

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

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article