Situation
We have a Magento installation that conatins multiple websites, each with its own URL. For example shop1.domain.com for website 1 and shop2.other.com for website 2.
Magento supports all it needs to do so, exept one little thing, a tiny but not unimportent part is missing for this solution to work out of the box.
You have to start the correct website in the bootstrapping, mapping to your shop.
In Fakt since the first version of magento i had to code this litle last step in the index.php and create multiple copies of the index.php and create multiple settings file for my apache server.
Solution
Please create a component that scans all the websites url's and build a cached repo where $_SERVER[\Magento\Store\Model\StoreManager:ARAM_RUN_CODE] and $_SERVER[\Magento\Store\Model\StoreManager:ARAM_RUN_TYPE] gets automatically set upon the $_SERVER['HTTP_HOST'] == $url_configured_in_setting
Help?
I allready have my own implementation of it, its just a patchwork direct in the index.php file, not a own class, i think you will do it it better, therefore i can send you my code, if its any help to you, just ask