Apache HTTPS redirection

You can set this up using an htaccess file, but that has a performance overhead.  I found the best way to do this, is to add a re-write rule in your site config.

First we need to enable the rewrite module:

sudo a2enmod rewrite
Now we can add the following our site config file (eg. /etc/apache2/sites-available/default), this needs to be placed at the top of the file, under the <VirtualHost *:80> section
rewriteengine on
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Now restart apache

sudo service apache2 restart