In .htaccess file in magento if SetEnv variable is set how this is processed in magento. For example:
SetEnv MAGE_RUN_CODE store
How does this works in magento index.php and displays the corresponding store.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
Setting environment variables in the .htaccess or virtualhost means they become available in PHP's $_SERVER superglobal array.
This bit of code in the index.php file grabs the store codes from $_SERVER and passes them to Mage::run when bootstrapping Magento.
/* Store or website code */ $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; /* Run store or run website */ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; Mage::run($mageRunCode, $mageRunType);
Mage::run sets up an instance of Mage_Core_Model_App and passes the codes to it, and Mage_Core_Model_App is responsible for everything from there, including rendering the particular store you've chosen.