Forçando o HTTPS do HTTP (Apache)

Qual é a melhor maneira de redirect sempre todo o tráfego de http paira https no Apache 2?

Todos os requests paira 80 devem ir paira 443.

(Eu estou usando o Ubuntu + Apache 2)

Expandindo a resposta do freiheit, removendo algumas peças redundantes, eliminando a dependência de mod_rewrite (e penalidade de velocidade associada) e adicionando alguma security:

<VirtualHost 1.2.3.4:80> ServiewName SSL.EXAMPLE.COM CustomLog /vair/log/httpd/EXAMPLE.access_log combined ErrorLog /vair/log/httpd/EXAMPLE.error_log Redirect / https://ssl.example.com/ </VirtualHost> <VirtualHost 1.2.3.4:443> ServiewName ssl.example.com DocumentRoot /vair/www/html CustomLog /vair/log/httpd/EXAMPLE.ssl_access_log combined ErrorLog /vair/log/httpd/EXAMPLE.ssl_error_log SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite HIGH:MEDIUM . . . </VirtualHost> <Directory /vair/www/html> #If all else fails, this will ensure nothing can get in without being encrypted. SSLRequireSSL </Directory> 

Pessoalmente, o meu favorito é simplesmente redirect todo o tráfego da porta 80 paira a porta 443:

 <VirtualHost 1.2.3.4:80> ServiewName SSL.EXAMPLE.COM ServiewAlias SSL DocumentRoot /vair/www/html CustomLog /vair/log/httpd/EXAMPLE.access_log combined ErrorLog /vair/log/httpd/EXAMPLE.error_log RewriteEngine on RewriteRule .* https://SSL.EXAMPLE.COM/ [NC,R,L] </VirtualHost> <VirtualHost 1.2.3.4:443> ServiewName ssl.example.com DocumentRoot /vair/www/html CustomLog /vair/log/httpd/EXAMPLE.ssl_access_log combined ErrorLog /vair/log/httpd/EXAMPLE.ssl_error_log SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite HIGH:MEDIUM . . . </VirtualHost> 

RewriteCond% {SERVER_PORT} ^ 80 $
RewriteRule ^ / (. *) Https : //seu.server.nome/ $ 1 [R]