Here is a code snippet to redirect the user back and forth from HTTP to HTTPS. This example shows how to transfer node/add forms in SSL.
Adding code to the menu hook to ensure it’s executed before anything else:
Adding code to the form_alter hook, to check if certain forms should be sent in SSL:
The guts of the code are added to a function that’s called from the theme:
Last I added a line to the top of the page.tpl.php file in my theme: