7

I am trying to configure my magento app for a multistore configuration, I followed the recommended step according to the magentocommerce tutorials below. I am getting a 404 error on the Home page for the 2nd store and cannot find where the configuration is failing. Below are my steps taken, tutorials used and troubleshooting steps taken.

Any help would be appreciated!

Steps Taken

  1. Set Default Root Categories – Packaging
    Using same catalog - so using the same default root category
    CATALOG>MANAGE PRODUCTS>
    Enabled Website = C*****-wholesale for products

  2. Create new Website, Store & Store Views:
    SYSTEM>MANAGE STORES>
    Website Name = C*****-wholesale
    Code = wholesale
    Store Name = Distributors
    Root Category = Packaging
    Store View - Distributors-English
    Code = dist

  3. Create Design Change for Wholesale Theme
    SYSTEM>DESIGN>ADD DESIGN CHANGE>
    Website = C*****-wholesale
    Store = Distributors
    Store View= Distributors-English
    Design =default/modern

  4. Changed Design template for scope - C*****-wholesale
    SYSTEM>CONFIGURATION>
    Current Config Scope: C*****-wholesale
    GENERAL>DESIGN>

    • disabled "Use Default"
    • theme>template = modern
  5. Add instance of home page for Store View = Distributor-English
    CMS>PAGES>
    Page Title = Home
    Store View = Distributors-English

  6. Change Base URLs - Mag Admin
    SYSTEM -> CONFIGURATION -> GENERAL -> WEB
    Changed base urls for scope = C*****-wholesale
    http://dist.c*****ment.com/
    https://dist.c*****ment.com/

  7. Add environment directives to htaccess:
    SetEnvIf Host www.dist.c*****ment.com MAGE_RUN_CODE=wholesale
    SetEnvIf Host www.dist.c*****ment.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^dist.c*****ment.com MAGE_RUN_CODE=wholesale
    SetEnvIf Host ^dist.c*****ment.com MAGE_RUN_TYPE=website

  8. Reset server and magento app.

    • Restart server
    • Reindexed
      SYSTEM>INDEX MANAGEMENT
    • Cleared caches:
      SYSTEM>CACHE MANAGEMENT
    • Recompiled
      SYSTEM>TOOLS>COMPILATION
    • Manually deleted cache folders var/cache

Tutorials Used

magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-domain-setup
magentocommerce.com/wiki/4_-_themes_and_template_customization/navigation/multiple-website-setup
magentocommerce.com/images/uploads/multistore_webinar-flv/multistore_webinar-flv.html

Troubleshooting

  1. Use Web Server rewrites - Disabling didn't solve.
    magento.stackexchange.com/questions/19382/magento-new-website-store-products-links-404-error
  2. Do not use same name for Website name and Store Name.
    lotusseedsdesign.com/blog/do-not-use-the-same-name-for-website-name-and-store-name
1

Be sure to set the default home page under Admin -> System -> Configuration -> Design -> Default Pages -> CMS Home Page. Change the Configuration Scope to each Store View and select the CMS pages that you've created for the home pages.

Edit:

Try this approach instead of .htaccess.

index.php

/* 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';


// New code 

switch($_SERVER['HTTP_HOST']) {
    case 'www.dist.c*****ment.com ':
    case 'dist.c*****ment.com ':
        $mageRunCode = 'wholesale';
        $mageRunType = 'website';
    break;
}

// end of New code

Mage::run($mageRunCode, $mageRunType);
  • I have also set the default home page, (omitted from my steps above). I changed the CMS Home Page and Disabled "Use Default" for that option in both the Store View=Distributors-English and Website=C*****-wholesale. Do I also need to change the "Default Web URL" or leave it to "Use Website"? – Dana Laney Jan 30 '15 at 16:31
  • On step 3 above you forgot to edit out your website name. You may want to asterisk that out too. – seanbreeden Jan 30 '15 at 16:38
  • See my answer edit. – seanbreeden Jan 30 '15 at 16:39
  • I revised the htaccess code with the recommended directives above but it didn't solve the 404 error. 1. Add environment directives to htaccess: - SetEnvIf Host www.dist.c*****ment.com MAGE_RUN_CODE=dist - SetEnvIf Host www.dist.c*****ment.com MAGE_RUN_TYPE=store - SetEnvIf Host ^dist.c*****ment.com MAGE_RUN_CODE=dist - SetEnvIf Host ^dist.c*****ment.com MAGE_RUN_TYPE=store – Dana Laney Jan 30 '15 at 18:01
  • Try adding the conditions in your index.php instead. Maybe the .htaccess variables aren't being passed to your index. See edited answer. – seanbreeden Jan 30 '15 at 18:18
0

Temporarily add this to your index.php

error_log('$mageRunCode '.$mageRunCode);
error_log('$mageRunType '.$mageRunType);

Mage::run($mageRunCode, strtolower($mageRunType));

check if you are getting the settings you expect.

0

Thanks to @seanbreedan for the clue that a CMS Home Page might not be set.

Even if you don't use the CMS Home Page (i.e. the home page is defined from layout and template files) it needs to be set.

A home page was set in Admin->System->Configuration->Web->Default Pages (note this is a slightly different path, I was in version 1.9) and applied globally to all the websites on my multisite setup.

Next I checked the home page in the CMS Admin->CMS->Pages. Find the home page that was specified in Default Pages, this was "home" in my case.

Check the page is enabled and that the Store View is selected for your websites or stores. In my case it was not enabled for the store that gave 404 errors. Once it was enabled the site worked.

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.