I've tried searching for this scenario, but can't seem to find exactly this setup. I want to have something along the lines of the following:
I want to have two subdomains redirect to different https sites with different document roots. The ssl cert we have is domain level (*example.com). The following doesn't seem to work, in that when I put more than one virtualhost for each port, I get "This webpage is not available". Any suggestions?
NameVirtualHost *:80 NameVirtualHost *:443 <VirtualHost *:80> ServerName subdomain1.example.com RedirectPermanent / https://subdomain1.example.com </VirtualHost> <VirtualHost *:80> ServerName subdomain2.example.com RedirectPermanent / https://subdomain2.example.com </VirtualHost> <VirtualHost *:443> DocumentRoot /srv/www/subd1/ ServerName subdomain1.example.com # more directives </VirtualHost> <VirtualHost *:443> DocumentRoot /srv/www/subd2/ ServerName subdomain2.example.com # more directives </VirtualHost>
We have the DNS directing both subdomain1.example.com and subdomain2.example.com to our server IP address.
Edit: Fixed an error in the example config (no ServerName directive) and added info regarding our DNS.