This is a good way to force all traffic to your site to use HTTPS while letting people who forget the 's' in HTTPS still get to your site. Pretend it is at
/etc/apache2/sites-available/example.com on a Debian system.
<VirtualHost *:80> ServerName example.com <Location /> Redirect permanent / https://example.com/ </Location> </VirtualHost> <VirtualHost *:443> ServerName example.com DocumentRoot /home/example/example.com SSLEngine On SSLCertificateFile /etc/apache2/ssl/example.com.crt SSLCertificateKeyFile /etc/apache2/ssl/example.com.key SSLCertificateChainFile /etc/apache2/ssl/example.com.ca-bundle </VirtualHost>
As you can see the first VirtualHost definition captures all traffic coming in on port 80 for the domain example.com and forwards it to port 443. Easy!