I have my apache server set up and I subdomains are linked to an application which will then find the appropriate database to work with or exit if it does not exist
So for that I have an *.domain.tld
But now I do need some subdomains for the server apps for example phpmyadmin.domain.tld
So I have set it up like this
<VirtualHost *>
DocumentRoot "/var/www/phpmyadmin"
ServerName phpmyadmin.domain.tld
<Directory "/var/www/phpmyadmin">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *>
DocumentRoot /var/www/hidden/app/public
ServerName *.domain.tld
<Directory "/var/www/hidden/app/public">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
But this way it always goes to phpmyadmin wathever I give test.domain.tld phpmyadmin.domain.tld helpme.domain.tld etc.
And If I put the second virtualhost (the *.domain.tld one) It wont go to phpmyadmin.domain.tld but just to the application
What am I doing wrong?
Update:
Still not working
This way it shows only phpmyadmin whatever I go to test.domain.tld phpmyadmin.domain.tld etc.
<VirtualHost *>
DocumentRoot /var/www/phpmyadmin
<Directory "/var/www/phpmyadmin">
allow from all
Options +Indexes
</Directory>
ServerName phpmyadmin.domain.tld
ServerAlias phpmyadmin.domain.tld
</VirtualHost>
<VirtualHost *>
DocumentRoot /var/www/hidden/app/public
ServerName domain.tld
ServerAlias *.domain.tld
<Directory "/var/www/hidden/app/public">
Allowoverride All
allow from all
Options +Indexes
</Directory>
</VirtualHost>
This way it only shows the app whatever I go to test.domain.tld phpmyadmin.domain.tld etc
<VirtualHost *>
DocumentRoot /var/www/hidden/app/public
ServerName domain.tld
ServerAlias *.domain.tld
<Directory "/var/www/hidden/app/public">
Allowoverride All
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *>
DocumentRoot /var/www/phpmyadmin
<Directory "/var/www/phpmyadmin">
allow from all
Options +Indexes
</Directory>
ServerName phpmyadmin.domain.tld
ServerAlias phpmyadmin.domain.tld
</VirtualHost>
apachectl -S output
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:* phpmyadmin.domain.tld (/etc/httpd/conf/httpd.conf:1015)
*:* domain.tld (/etc/httpd/conf/httpd.conf:1025)
Syntax OK