I own secure site https://example.com.
This is my apache2 config:
<VirtualHost *:443> ServerName example.com DocumentRoot /var/www/example.com </VirtualHost> <VirtualHost *:443> ServerName x.example.com ServerAlias *.example.com Redirect 301 / https://example.com </VirtualHost> <VirtualHost *:80> ServerName example.com ServerAlias *.example.com Redirect 301 / https://example.com </VirtualHost>
This works fine with http://whatever.example.com: Apache handles the request and redirects to the correct URL. However, there is a problem with https://whatever.example.com. At least on Chrome, I first get warning that this site is not secure (obviously, there is no ssl certificate for whatever.example.com), and only when I force the browser to load that page, only I get redirected.
So, is there a better redirect than what I am using right now? One that would not confuse user with strange browser warnings.