magentomultiple-sites

Set envif Host Magento Multiple Stores


I am trying to get a magento installation to run multiple websites I have completed most of the steps including a parked domain. However I am unsure as to how to answer the statement below:

Easiest amongst these is .htaccess solution which requires you to define the following lines:

SetEnvIf Host .*myhost.* MAGE_RUN_CODE="base";
SetEnvIf Host .*myhost.* MAGE_RUN_TYPE="website";

Simply ensure that .myhost. is a regex expression matching the domain for which you want to set environmental variables for.

For example do my website is www.domain.com and also www.domain1.com, magento is installed on domain.com so for the host do I put .domain.com. and leave the run code and type and base and website


Solution

  • What you are supposed to change is the MAGE_RUN_CODE to match the code of the site that is managed in the Magento backend. You also need to change the myhost bit match the domain name of your site.

    So for example, if your site is hosted on somewebsite.com and you have two "stores" (Store View A and Store View B, Where "ViewA" is Store View A and "ViewB" is Store View B.)

    You would write the following:

    SetEnvIf Host .*somewebsite.* MAGE_RUN_CODE=ViewA
    SetEnvIf Host .*somewebsite.* MAGE_RUN_TYPE=website
    
    SetEnvIf Host .*somewebsite.* MAGE_RUN_CODE=ViewB
    SetEnvIf Host .*somewebsite.* MAGE_RUN_TYPE=website
    

    This assuming you made two different "Sites" in the Magento Backend. If you made a different store, you'd replace "website" with store.

    More reading on the Magento renaming can be found here:

    http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/navigation/multiple-website-setup