How do I force SSL/HTTPS on my websites?

To force SSL on all websites located under your .htaccess, add this rule:

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

To force SSL on a single/specific website and not all websites, add this rule:

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

In the above example, you would replace "domain.com" with your specific domain name.

Please note that in order for SSL/HTTPS to work you must first have an SSL certificate installed on your site. We offer free SSL certificates through Let's Encrypt. Instructions on how to install your free SSL certificates can be found here: How do I install my free Comodo SSL Certificate?
  • 0 Users Found This Useful
Was this answer helpful?