Quick notes and needs to be flushed out and tested.
Introduction
Different ways of doing this. Complete rewrite or file based. We'll cover both but the recommended approach is to use rewrite which covers not just the main index file but all scenarios.
Switch HTTP to HTTPS
...
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
Switch HTTPS to HTTP
...
RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}