3

In the settings I have a website and how can I find out MAGE_RUN_CODE, which I will inscribe in .htaccess?

3
  • what you want to achieve ?
    – inrsaurabh
    Mar 26 '18 at 8:08
  • You want to run specific website from .htaccess configuration? Mar 26 '18 at 8:17
  • I want just set SetEnvIf Host myUrl MAGE_RUN_CODE=goal SetEnvIf Host myUrl MAGE_RUN_TYPE=website Mar 26 '18 at 8:36
4

The value of MAGE_RUN_TYPE determines if MAGE_RUN_CODE should be considered the code of a website or a store. Now let’s look at Magento: a website has a code (the default websites’ code is “base”), and a store (what is actually a view, since a store can have multiple views) also has a code (the default websites’ view is “default” by default, unless you’ve changed this off course). Now if you have a situation like I had, where you had a Magento installation with multiple websites and each multiple stores, you have different codes for both. For example, you might have the following website codes:

  • site1
  • site2
  • site3

And the following store codes (each representing a view in a specific site):

  • site1_en
  • site1_nl
  • site2_en
  • site2_nl
  • site3_en
  • site3_nl

Now let’s see what happens when I try to do this:

Mage::run('site2_nl', 'website');

What you telling Magento here is to load the website with the code site2_nl . But as we see, there is no website with that code. Therefore Magento will fallback to it’s default site, or show a 404 page if it fails to do that.

Reference: https://gielberkers.com/difference-mage_run_type-website-store-magento/

1
  • You can find the store codes in the store.code field and the website codes in store_website.code field (for M2 at least). May 19 '20 at 14:25

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.