Magento – Multi Store doesnt work – .htaccess

ce-1.9.2.2multistoreserver-setup

I created a multi store but I have a problem.

I use magento 1.9.2.2 – can you tell me if i need to modify the index.php and the htaccess?

I modified the htaccess as follows:

SetEnvIf Host www\.magento\.zweitedomain\.de MAGE_RUN_CODE=neuestorecode
SetEnvIf Host www\.magento\.zweitedomain\.de MAGE_RUN_TYPE=website
SetEnvIf Host ^magento\.zweitedomain\.de MAGE_RUN_CODE=neuestorecode
SetEnvIf Host ^magento\.zweitedomain\.de MAGE_RUN_TYPE=Website

The second domain points to the mainserver via a-Record and IPv4. But it doesnt work!

Do I need to make other changes? I read that the domain should Point to the document_root of the main store – is the way via a-Record enough?

I also tried to Change the index.php and added the following code above Mage::run($mageRunCode, $mageRunType);:

switch($_SERVER['HTTP_HOST']) {
    case 'domain.de': Mage::run('MEIN_STORECODE_DE','store'); break;
    case 'zweitedomain.de: Mage::run('MEIN_STORECODE','store'); break;
    case 'www.domain.de': Mage::run('MEIN_STORECODE_DE','store'); break;
    case 'www.zweitedomain.de': Mage::run('MEIN_STORECODE','store'); break;
    default: Mage::run($mageRunCode, $mageRunType); break;

how to do setup of multi store?

Best Answer

First of all, you don't need to do any changes in index.php. An example apache configuration that you can add at the top of your .htaccess file is:

SetEnv MAGE_RUN_TYPE website
SetEnvIf Host magento\.zweitedomain\.de MAGE_RUN_CODE=zweitewebsite

(if zweitewebsite is the code of your second website)

I usally don't add the ^ and $ delimiters, so that all subdomains or developer instances are matched as well as long the host contains "magento.zweitedomain.de":

  • www.magento.zweitedomain.de
  • test.magento.zweitedomain.de
  • magento.zweitedomain.de.local