How to redirect all subdomains to the root domain?
It works for non-SSL domains, but doesn't work for SSL domains!?
eg
Works!
wee.domain.com => https://domain.com
www.domain.com => https://domain.com
Doesn't work! (no redirecting)
https://wee.domain.com => https://domain.com
https://www.domain.com => https://domain.com
vhosts
<VirtualHost *:80>
ServerName domain.com
# force https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]
...
</VirtualHost>
<VirtualHost *:443>
ServerName domain.com
SSLEngine on
...
</VirtualHost>
<VirtualHost *:80>
ServerAlias *.domain.com
RewriteEngine on
# Redirect all subdomains to root
RewriteRule ^ https://domain.com [L,R=301]
...
</VirtualHost>
########## This vhost is not working ###############
<VirtualHost *:443>
ServerAlias *.domain.com
RewriteEngine on
# Redirect all subdomains to root
RewriteRule ^ https://domain.com [L,R=301]
SSLEngine on
...
</VirtualHost>