Paste this into your .htaccess file

# BEGIN Force SSL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
# END Force SSL

I once had the needed to exclude a directory, so http:// versions would still be served. This was just one extra line:

RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_URI} !^/directory/
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Leave a Reply

Your email address will not be published. Required fields are marked *