So I have an Ubuntu server running Apache 2 and would like to redirect all traffic over to https. Below is the sites-available config file (with domain name substituted out.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect permanent "/" "https://example.com/"
</VirtualHost>
<VirtualHost *:443>
ServerAdmin example@emailcomp.com
DocumentRoot /var/www/personal/html/
ServerName https://example.com
ServerAlias https://www.example.com
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload"
</IfModule>
<Directory /var/www/personal/html/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/personal/html
SetEnv HTTP_HOME /var/www/personal/html
</Directory>
ErrorLog ${APACHE_LOG_DIR}/personal-error.log
CustomLog ${APACHE_LOG_DIR}/personal-access.log combined
ServerAlias example.com
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
https://example.com definitely works and is encrypted. How can rewrite the config to redirect all traffic to https?