Pages

Tuesday, July 2, 2013

How to set a Store View via .htaccess Magento

.htaccess

You can set the Store View code adding the following line to your .htaccess

In this example my Store View code is “french”:
SetEnv MAGE_RUN_CODE french

Hint: you can see your Store Views codes through your Admin > System > Manage Stores
How does it work?

In your index.php file in your root directory you will find the following lines (probably at the end of the file).

As you can see it uses the $_SERVER['MAGE_RUN_CODE'] if it has been set.
/* 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';

No comments:

Post a Comment