Skip to content

Force HTTPS with .htaccess

For Apache or hosting environments that support .htaccess.

Add this to the website root .htaccess file:

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

After saving, http://example.com should redirect to https://example.com.

Released under internal 12SSL documentation guidelines.