Apache-RedirectHTTPtoHTTPS
From Mike Neir's Wiki
[edit]
Premise
The idea behind this is that some people want their unsecure http traffic to redirect to secured https connections automatically and transparently. This is achieved easily through the following rewrite rules.
RewriteEngine on
RewriteCond %{SERVER_PORT} !443 [NC]
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L,QSA]
[edit]
Notes
- The only real caveat is that the rewrite condition assumes your HTTPS port to be the default of 443. changing the port number in the rewrite condition should fix things if you're using an nonstandard HTTPS port.
