Manual:$wgWikiFarmSiteDetector

Details
Callback to use to determine the name of the requested site for the current request. Per default, a method built into WikiFarmSettingsLoader is used, which will try to determine the wiki name based on the  environment variable (if set), or the requested (virtual) host.

Must return a string or. The return value is used together with the WikiFarmSettingsDirectory and WikiFarmSettingsExtension to construct the path of the settings file that holds site specific configuration for the requested site.