Thorsten Rintelen Thorsten Rintelen - 5 months ago 11x
PHP Question

Forward to wrong magento store

This is my code in the index.php of Magento to switch the Store:

if ($url['host'] === '') {
if ($geoplugin->countryCode === 'CH') {

Mage::run('five_oaks_german', 'store' );
} else {
Mage::run('default', 'store');

If i call the url
magento loads not the store
but the default store. The url in browser change to url of the default store.

Why shows magento not call the
The store settings the url seems to be correct.


Can you post the output of $url?

The best way of doing this though is to use the MAGE_RUN_CODE and set it in the vhost (if you're using Apache) or use 'map' if you're using Nginx.

In Apache you can do this using .htaccess if you don't have access to the vhost:

SetEnvIf Host .** MAGE_RUN_CODE=five_oaks_german

Taken from:

If you're on Nginx then you can use the 'map' - see