Given a username, I'd like to 'dynamically' create a sub domain.
I read the answers in
Create subdomains on the fly with .htaccess (PHP)
And though it's good, it's not working for me, (I think) because I have multiple domains on my server (I've asked my initial question here https://superuser.com/questions/720911/wildcard-subdomain-being-redirected-to-the-wrong-domain/720913?noredirect=1#comment923298_720913).
My set up is
- Linode VPS
- Apache
- Ubuntu
I have multiple domains
- abc.com
- def.com
I want my dynamic sub domains on the second domain (e.g. x.def.com, y.def.com).
So I've created a wildcard DNS entry via my DNS manager.
But since "abc.com" is the first domain that's configured, it seems like it's doing "catch-all" for any subdomain in a form of "x.def.com".
Is it possible to still achieve the dynamic subdomain creation in my set up?
my virtual host set up is below
# in file /apache2/sites-available/abc.com
<VirtualHost *:80>
ServerName www.abc.com
DirectoryIndex index.php index.html
DocumentRoot /home/website/public/abc.com/public/
</VirtualHost>
# in file /apache2/sites-available/def.com
<VirtualHost *:80>
ServerName www.def.com
ServerAlias *.def.com
UseCanonicalName Off
DirectoryIndex index.php index.html
DocumentRoot /home/website/public/def.com/public/
</VirtualHost>