1

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.

2

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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.