I set up HTTPS for my website for the first time today. I started with the following code:
<VirtualHost *:443>
ServerName website.tld
DocumentRoot /var/www/website.tld
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/website.tld.crt
SSLCertificateKeyFile /etc/apache2/ssl/website.tld.key
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/website.tld/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
which totally worked fine. Now I wanted the website to redirect http to https and added the following at the top:
<VirtualHost *:80>
ServerName website.tld
ServerAlias www.website.tld
Redirect 301 / https://website.tld
</VirtualHost>
<VirtualHost *:443>
ServerName www.website.tld
Redirect 301 / https://website.tld
</VirtualHost>
Now if I access the website from http it redirects to https, BUT once I'm on the https site I get an error from Chrome saying "ERR_SSL_PROTOCOL_ERROR". Can somebody help?