How to force using an SSL connection on a website?
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Note: If you have an existing .htaccess file, please always make a backup copy before editing it, to be able to restore it, if you make a mistake.