1

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?

  • It's not a proper solution but it's one of the solution just rename your local.xml and install again – Magento 2 Oct 20 '15 at 18:47
  • Most likely SetEnvIf isn't working as expected, see: stackoverflow.com/questions/9212292/… – B00MER Oct 20 '15 at 19:13
  • Thank you, Boomer. It's not SetEnvIf. I tried simply MAGE_RUN_CODE=whitelabel MAGE_RUN_TYPE=store and it still does not work. In index.php, isset($_SERVER['MAGE_RUN_CODE']) is false. – Joe Palaca Oct 20 '15 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.