How to set multiple websites with multiple store views in Magento

How to set multiple websites with multiple store views in Magento

If you work with Magento, sooner or later you will end up needing multiple websites that have
multiple languages.
Most of you know this, but I hope someone will still find this post useful.

There are few ways of doing same thing, but in my experience way I’m going to present now causes
less problems even though it is less automatic than some other ways.

Let’s say we want 2 websites and 2 languages for each site.

Here’s procedure:

In admin panel, go to System->Configuration and click on “Manage Stores”
Click on “Main Website” to change it’s name to “Website 1” or however you want to call it. (I’ll call mine “Website 1” for the purposes of this article).
In “code” field there, write something like “website_1”.

Do same for “Main Website Store”. Call it “Website store 1”.

And guess what… do same for “Default Store View” that you can find on same interface.
How to call it?
Hm… I’ll call mine “English Store View”
I’ll write “english_store_view_website_1” in “code” field there.

Ok, let’s go make second one…
Add website named “Website 2” with code “website_2”.
Add store called “Website store 2” and assign it to Website 2 that you can chose from dropdown.
Add new store view called “English Store View” with code “english_store_view_website_2” and
assign it to “Website 2” that you can find in dropdown.

By now you should have 2 websites with 1 language each.

Add two more store views.
Call first “German Store View” with code “german_store_view_website_1”.
Call second “German Store View” with code “german_store_view_website_2”.
Assign them to corresponding websites.

Let’s see what we have at this moment:

1) a) Website 1 (code: website_1) – Website Store 1 English Store View (code: english_store_view_website_1)
b) Website 1 (code: website_1) – Website Store 1German Store View (code: german_store_view_website_1)

2) a) Website 2 (code: website_2) – Website Store 2 English Store View (code: english_store_view_website_2)
b) Website 2 (code: website_2) – Website Store 2German Store View (code: german_store_view_website_2)

Of course, I didn’t mentioned that you will need to chose root category for your stores, do what ever you like there.

Ok, let’s say we want url to be handled this way:
1) http://www.yourdomain.com/website_1
2) http://www.yourdomain.com/website_2

In your Magento installation directory, make 2 directories called “website_1” and “website_2”
Copy .htacces and index.php from your root directory in each of those new directories.

In .htaccess search for “RewriteBase /” line and replace it with “RewriteBase /website_1/” in first directory, and
search for “RewriteBase /” line and replace it with “RewriteBase /website_2/” in second directory.

In both directories open index.php and change “$compilerConfig = ‘includes/config.php’;” to
$compilerConfig = ‘../includes/config.php’;

Change $mageFilename = ‘app/Mage.php’; to $mageFilename = ‘../app/Mage.php’;

In same file make sure to edit Mage::run() function for each site:

Mage::run(‘website_1’, ‘website’);
Mage::run(‘website_2’, ‘website’);

Go to System->Configuration and select Current Configuration Scope: Website 1

Set absolute paths to your skin, js and  media directories and set Base URL = http://www.yourdomain.com/website_1  (do that for website_2 too)

Now use this dirty way to switch between websites 🙂
https://inchoo.net/ecommerce/magento-snippet-for-switching-between-websites/

Since there is much to say about this subject, feel free to ask questions and I’ll try to answer them asap.

Related Inchoo Services

You made it all the way down here so you must have enjoyed this post! You may also like:

How To Connect Google Analytics 4 To Magento 2 Bojan Mareljic
Bojan Mareljic, | 35

How To Connect Google Analytics 4 To Magento 2

Get rewritten product url in a different store Petar Sambolek
Petar Sambolek, | 9

Get rewritten product url in a different store

Magento snippet for switching between websites Tomas Novoselic
, | 23

Magento snippet for switching between websites

127 comments

  1. Hello , I have a main website and have 5 store view but i want these 5 store view have different website name and different store name. and assign different domain name to them. Is it possible?

  2. Hi,

    I have setup multiple websites (website1 and website2) by following this tutorial. The home page works fine for both websites however, it gives 404 page not found error while navigating to category and products in website2. Can anyone please point me in the right direction to fix this problem?

    Regards

    1. You probably have error in your website_2 .htaccess file. I had the same problem and had marked wesbsite_2 instead of website_2 in the .htaccess config

  3. Hello every one
    If you getting this error ../app/Mage.php was not found
    Please Try this /../app/Mage.php
    This is work for me.

  4. I got the project that client need website with multi language and multi currency. i have know idea how to do it because i a little bit confuse between web store and store view

  5. if we want the same url like : http://www.yourdomain.com , is still we need to create “website_1” and “website_2” directories ? we created only multiple store views. is there any changes we need to do in .htaccess file ?

  6. Hi!
    I have set up a second website with one store and two store views (for two languages).
    The second website requires lower prices than the first. The problem I am facing is, that I am only
    able to set a price per store view, that means in order to assign a different price for website two I will
    have to do it twice as I can’t select the website scope in order to have the price change affect both
    store views.
    I have change the config setting for catalog price scope from global to website.
    I have tried to run the second website on a different root catalog or on the same as the first one to
    no avail.
    Is this supposed to work like that?

    Regards

  7. Is there any way to setup extensions for multi store sites ? Like enable extension for 1 site and disable for another.

    1. If you want to disable an extension simply go under system > configuration > advanced. Select your store and disable the extension you don’t want.

  8. Hi!
    I Have my shop in 2 languages, but i cannot seem to change a few of the details on the site in the second language which is Romanian. For example in the menus I don’t know how or where to change the “wiev all” text to the romanian version “Vezi tot”

  9. Hi,

    I’m already setting my site follow by your tutorial, but i’m get

    ../app/Mage.php was not found

    on my second website. May i know what did i do wrong?
    Hope to hear from you.

    Regards.

  10. Uhm… my question is: I have 1 website, with N different stores (a main website and N – 1 stores which display a subset of categories/products of the main website), each store has 4 languages.
    So, let’s say I have STORE_MAIN and STORE_SUB_1, and each store has VIEW_ENG, VIEW_FRA, VIEW_DEU. Now, on STORE_MAIN.VIEW_FRA I can see my products and categories translated into French, but when I switch to STORE_SUB_1.VIEW_FRA, products are still in plain English. I assume it’s the way Magento handles Store/View, but it makes product managament damn hard if for any product I have to change the French translation N times on any VIEW_FRA of each store. I’m pretty sure I’m missing something obvious and I’d be glad if someone out there can help me!

  11. I’m trying to add a different language for my store for a week now… But I still have a problem and I don’t know what to do anymore.
    I have one website, one store and I want two languages (the default is Dutch). I want to add an English version with the same products. When I go to the “Manage” store part, the English store view is visible and enabled. But when I go to Admin > Configuration and I want to go to the English store view, there’s nothing there in the dropdown menu of the Current Configuration Scope, only the default config and the Default Store View (the dutch one). Also when I’m trying to change the name of the Dutch one, it looks like Magento only updates it in “Manage Stores” and not anywhere else. I’m desperate right now.

    Reindex or cache doesn’t work… Already tried that. The default config option in Web > URL options > Auto-redirect to Base URL is set to “No”. Can anyone help me??!!!

  12. I am also trying to do what Felix is. Is there any way to link store views with the same store code perhaps and update the descriptions across all storeviews?

    My store setup:

    Website
    Store
    Store Views

    UK
    UK Company
    – English
    – French
    – German
    – Spanish

    US
    US Company
    – English
    – French
    – German
    – Spanish

    EU
    EU Company
    – English
    – French
    – German
    – Spanish

    Hopefully someone can point me in the right direction.

  13. Hi All.
    I have two websites.
    1) International
    2) Us

    Each website had two store view (langauge)
    1.a International_franch
    1.b International_english

    2.a Us_franch
    2.b Us_english

    So, I have one question. How can do, that product attributes were the same values for International_franch and Us_franch websites. I want change product name or product description for two franch store views one time. Can I do that?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.