Ali
Ali

Reputation: 154

Magento keeps redirecting to default website for a multisite store

We have 3 website in a Magento store. Here's what I've done.

  1. I have downloaded the code from the live site to my local machine
  2. set up the vhost for the 3 websites

    created site1(2 & 3).com.conf and enabled them
    
  3. Added the corresponding lines to /etc/hosts
  4. In my .htaccess I have the code that manages the 3 websites

    SetEnvIf Host www\.site1\.com MAGE_RUN_CODE=site1
    SetEnvIf Host www\.site1\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^site1\.com MAGE_RUN_CODE=site1
    SetEnvIf Host ^site1\.com MAGE_RUN_TYPE=website
    SetEnvIf Host www\.site2\.com MAGE_RUN_CODE=site2
    SetEnvIf Host www\.site2\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^site2\.com MAGE_RUN_CODE=site2
    SetEnvIf Host ^site2\.com MAGE_RUN_TYPE=website
    SetEnvIf Host www\.site3\.com MAGE_RUN_CODE=site3
    SetEnvIf Host www\.site3\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^site3\.com MAGE_RUN_CODE=site3
    SetEnvIf Host ^site3\.com MAGE_RUN_TYPE=website
    

Everything is working fine on the live server but on my local machine when I type www.site1.com or www.site2.com I'm automatically redirected to www.site2.com as it's the default website.

I'm on Ubuntu 14.04 I've just set up the whole environment (apache2, php5, mysql) as my machine was formatted last week.

Thanks,

Upvotes: 1

Views: 3902

Answers (2)

Ali
Ali

Reputation: 154

It seems something is wrong with my Apache configuration.

SetEnvIf Host returns an empty value

I switched to setting the values in each of my vhosts

SetEnv MAGE_RUN_CODE "site1"
SetEnv MAGE_RUN_TYPE "website"

The only difference between local and production is Apache version 2.4 in local and 2.2 in production

Upvotes: 1

Dhaval Patel
Dhaval Patel

Reputation: 1096

did you change url for each website.Please check core_config_data table or you can change it in admin.

admin->system->configuration->general->web->(Secure and unsecure Url)

Upvotes: 0

Related Questions