How to force https using .htaccess?

Written by
Henry Blake
Henry Blake
In order to force https for all your pages you need to add the following lines to your .htaccess file:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
Warning
You need to change example.com to your own domain name.