I am using apache on ubuntu 14.04. I set up a wildcard domain for my site but it isn't working how I would like it to. I want
www.example.com --> /var/www/mysite
example.com --> /var/www/mysite
and everything else to go to
*.example.com --> /var/www/myothersite
BUT, Right now it is working like this
example.com --> /var/www/mysite
and
www.example.com --> /var/www/myothersite
*.example.com --> /var/www/myothersite
I created the virtual hosts by creating two conf files in sites-available/
example.com.conf
catchall.example.com.conf
Here is the contents of example.com.conf
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/mysite
Here is the contents of catchall.example.com.conf
ServerName catchall.example.com
ServerAlias *.example.com
DocumentRoot /var/www/myothersite
After I created the files I ran a2ensite on the files and reloaded apache. Any idea on how I can achieve the results I am looking for while still using sites-available and a2ensite?