How do I set it up such that https://anything.example.com
redirects to https://example.com
properly?
My current setup goes like this:
http://example.com --> https://example.com
http://subdomain.example.com --> https://example.com
I have a CNAME record with my webhost that points *.example.com to example.com.
The problem is that I don't have a wildcard certificate, so when users try to go to https://subdomain.example.com, they are met with this pleasant page.
Here's my configuration file:
<VirtualHost *:80>
ServerName example.com/
Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /home/ssl.crt
SSLCertificateKeyFile /home/ssl.key
SSLCACertificateFile /home/intermediate.crt
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Options -Indexes
</Directory>
I'm running Apache2 on Ubuntu 14.04. I'm not using an .htaccess file.