In the settings I have a website and how can I find out MAGE_RUN_CODE, which I will inscribe in .htaccess?
-
1what you want to achieve ?– inrsaurabhMar 26, 2018 at 8:08
-
You want to run specific website from .htaccess configuration?– Shashank GuptaMar 26, 2018 at 8:17
-
I want just set SetEnvIf Host myUrl MAGE_RUN_CODE=goal SetEnvIf Host myUrl MAGE_RUN_TYPE=website– Павел КушнеревичMar 26, 2018 at 8:36
1 Answer
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/
-
You can find the store codes in the
store.code
field and the website codes instore_website.code
field (for M2 at least). May 19, 2020 at 14:25