I have a live Magento site with a main store and also white-label stores located on sub-domains, all running out of the same Magento website. I'm using .htaccess to direct sub-domains to the corresponding stores like so:
SetEnvIf Host www\.whitelabel.mysite\.com MAGE_RUN_CODE=whitelabel SetEnvIf Host www\.whitelabel.mysite\.com MAGE_RUN_TYPE=store SetEnvIf Host ^whitelabel.mysite\.com MAGE_RUN_CODE=whitelabel SetEnvIf Host ^whitelabel.mysite\.com MAGE_RUN_TYPE=store
This works great on my live site. However, I copied everything to a local Apache dev instance on an Ubuntu VM, and the sub-domains don't load their corresponding stores; they all just load the main store. I didn't make any changes to the .htaccess file. My virtual host file seems to be correct:
ServerName mysite.com ServerAlias www.mysite.com ServerAlias whitelabel.mysite.com ServerAlias www.whitelabel.mysite.com DocumentRoot /var/www/mysite.com/public_html
I think my hosts file is correct:
127.0.0.1 mysite.com 127.0.0.1 www.mysite.com 127.0.0.1 whitelabel.mysite.com 127.0.0.1 www.whitelabel.mysite.com
If I go to mysite.com in a browser on my dev box, it loads my main store, as it should. But if I go to whitelabel.mysite.com, it also loads my main store, but it should load my white-label store. What am I missing?