I have a wildcard SSL certificate and I want to redirect all http requests to their equivalent https.
My server is a Debian (wheezy) and I am running Apache 2.2.22
I have added the following at the end of /etc/apache2/apache2.conf
<VirtualHost *:80>
ServerName domain.tld
ServerAlias *.domain.tld
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</VirtualHost>
<VirtualHost *:443>
ServerName domain.tld
ServerAlias *.domain.tld
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
SSLEngine on
SSLCertificateFile /path/file.crt
SSLCertificateKeyFile /path/file.key
SSLCertificateChainFile /path/file.crt
SSLCACertificateFile /path/file.pem
</VirtualHost>
This works well for subdomains but not the naked domain (http://www.domain.tld goes to https but http://domain.tld does not)
What is it that I am missing?