We currently have a mutltisite setup of more than 20 sudomains for customers.
The same codebase is used for all sites, let's just say it is located in the folder /srv/code.
Apache's root directory points to it as well.
Now we have to create a folder under /var/www/subdomain for each subdomain and put a configuration file called config.ini there.
How do I tell Apache now when the PHP script searches for the file config.ini that it can find it here: /var/www/subdomain ?
And is it the best solution ever?
Is this a shared host? If yes, you should first check if a script inside /srv/code is allowed to access a file in /var/www/subdomain.
You can extract the domain the current script was called via from $_SERVER['SERVER_NAME']. You can then use this information to extract the subdomain from it and access the config.ini in the correct directory.
This is probably easier then doing it in Apache.