It is really simple using .htaccess with mod_rewrite.
Here is all you need:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://site.com/$1 [R=301,L]
Another more graceful way is to use the %{SERVER_NAME} variable to make it dynamic. Just be careful that the server name will always match what you expect. (eg. if you are doing load balancing or clustering what if the server name may be something other than the public facing URL).
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
The above just detects that the user has connected with non-SSL by connecting to port 80. When that condition is detected it just rewrites the url to the same thing only with https:// to "site.com" (make sure you change site.com to your domain)
apache, htaccess, mod_rewrite, redirect, urls, ssl, https, versionit, rewritecond, server_port, rewriterule, graceful, server_name, variable, dynamic, server, eg, balancing, clustering, url, detects, user, connecting, detected, rewrites, quot, domain,