Our blog
Magento Multistore Setup in a Nutshell
One of the really cool features of Magento is the ability to easily setup a multistore on one installation of Magento. If you have never done it before though it can be a little tricky.
Here is very brief guide:
First create the stores. This is all done via the Magento administration.
System->Manage Stores
foreach store that you want, create a website, store and store view. Make a note of the codes as you need those in the code below.
Then in your index.php file have some code like this:
-
-
switch($_SERVER['HTTP_HOST']) {
-
-
case 'first-store.com':
-
case 'www.first-store.com':
-
Mage::run('store1', 'store');
-
break;
-
-
case 'second-store.com':
-
case 'www.second-store.com':
-
Mage::run('store2', 'store');
-
break;
-
-
-
case 'third-store.com':
-
case 'www.third-store.com':
-
Mage::run('store3', 'store');
-
break;
-
-
default: //run the default store if for some reason the above hasn't worked.
-
Mage::run();
-
break;
-
}
More Reading:
2 Comments
|
Just to be clear, the two parameters for Mage::Run are 'websitecode','storecode' or 'storecode','websitecode' ? I got it to work by putting ONLY the storecode in, but not with both or with just the website code. This is a bit frustrating because I expect to have multiple language stores within one website (same domain), and I'm not quite sure how I can make that work. I'm using Magento 1.3.4 currently. Any other hints that you might add in this topic would be great! |
|
the second parameter is either 'website' or 'store' and defines what type of code the first parameter is |
RSS Feed
David
October 16th, 2009