Knowledge Base

How to force SSL & HTTPs with .htaccess on your site

Now that HTTPs is a major requirement, you will need to enforce this on your site. You can force SSL or HTTPs very easily via the file .htaccess.

To force SSL, you will need to make sure Mod_Rewrite is enabled on your server. Edit your .htaccess file and add the code below.

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

If your .htaccess file had already the first line i.e. RewriteEngine On, do not add it again.

Was this helpful? 😃 😞

Still have questions?

If you still have questions, feel free to open a ticket and we will gladly help you out!

Open a ticket