mysql_vhosts Complex SQL
Upon reading the documentation I came up with the below SQL:
SELECT * FROM (SELECT IF((SELECT rootdir FROM vhosts WHERE vhost='?'),(SELECT rootdir FROM vhosts WHERE vhost='?'),(SELECT rootdir FROM vhosts WHERE '?' like vhost)) as rootdir) as a WHERE rootdir IS NOT NULL
This will return a row with an exact match to the host or if not found a row matching '%.example.com'. If neither are found it returns nothing. However it breaks the vhost.
Which should return a path of: /var/www/vhosts/bfddesigns.net/subdomains/test/index.php but does not.
When I revert the SQL to the default SQL everything works fine.
Also available in: Atom