How To Setup And Manage Domains and Multiple Stores In Magento.

setup-manage-multiple-stores

Magento‘ is a handy and flexible eCommerce framework, empowered to manage various different front-ends & stores having multiple domains with one dashboard.

As per your need, you can configure a Magento installation depending upon its setup by spreading out multiple sub-domains amongst different stores, that can be managed with a single admin. All these stores can even share customers, settings and common product catalogs.

This multisite-multistore concept offers various benefits for you by creating and showing variants in the products, categories and CMS pages as per your store or website requirement.

Although, the methodologies discussed below apply irrespective of using any control panel, this blog is written keeping cPanel in mind and you may need to install Magento 1.4.x or higher version.

Why  you should go for Multiple Stores ?

  • Serving different customer sections with their different requirements (e.g. B2B and B2C)
  • Multiple brands having their  respective needs and identity
  • Targeting various customers to sell a number of  products
  • Selling in different countries with different currency, tax and language.

What are the Features Offered By Magento?

Within a single installation, Magento offers various advanced features to your multiple websites and stores. Magento helps to structure the store as Website Domain, Stores and Store Views.

  • Website – A Website usually can be set up not to share any data or to share customer data and it may contain one or two stores.

  • Store – At store level, Products and its Categories can be managed to allow multiple stores within the one website and having entirely different catalog layout.

  • Store View – It allows multiple visualizations of the data and every store view for catalog structure will remain same. Store views allows customers to choose and switch between 2 or many languages.

As per your requirements, you can use a number of ways to setup and manage domains and multiple stores in Magento, shared with a single back-end and code-base.

Before proceeding further, first you should clearly understand the choice on how to address a store and its setup URL layout.

URL layout

It is a matter of your personal need and choice to structure the actual URL layout.

For e.g. two solely different stores operated on a single domain may share the same instance of Magento:

  • domain.com / trousers
  • domain.com / sweaters

Also, these stores could also be setup on their respective domain and sharing the same instance of Magento :

  • trousers.com
  • sweaters.com

Furthermore, in a mall type setup, you can access different stores with your primary domain as a portal:

  • mall.com
  • trousers.mall.com
  • sweaters.mall.com

Irrespective of the URL layout, the process of setting up these stores are same having a single code-base to run all stores, and a single back-end to manage all of these stores.

Adding Another Store

First of all, you need to setup your second store in Magento.

For e.g. you can assume to own  trousers.com.

Configure the required values accordingly for this store.

  • Logging in to the admin of Magento.
  • Go to the Catalog tab, and select Manage Categories.
  • On the left, Enter Add Root Category tab.
  • On the right, enter trousers.com, set both the stores drop-down to ‘Yes’ for Is Active and Is Anchor.
  • Select the Save Category tab.
  • Select Manage Stores by entering to the System tab.
  • Enter Create Website.
  • For Name, enter ‘trousers.com' and for the Code enter ‘trousers’.
  • Enter the Save Website tab.
  • Enter Create Store.
  • On drop-down, select trousers.com for Website. For the Name,  enter Main Store, and from the drop-down select the trousers.com, for the Root Category.
  • Enter the Save Store  tab.
  • Enter the Create Store View button.
  • From the drop-down, enter Main Store, For the Store. And confirm it’s for the trousers.com website. Enter English,For the Name, Enter trousers_en,for the Code, From the drop-down, choose Enabled, for the Status.
  • Enter the Save Store View tab.
  • Choose Configuration by entering the System tab.
  • Alter the drop-down menu on Default Config to trousers.com, the Current Config Scope (located on the top left)
  • Under the General heading, from the left sidebar, choose Web.
  • Un-check the Use default box next to the Base URL products, for both sections with the Secure and Un-secure. Enter URL, e.g. http://www.trousers.com/.
  • Enter the Save Config tab.

All above steps are essential to setup second store.

To set-up the store on the server-side for a convenient access to the visitors, you’ll need to choose the best one from the various processes discussed below :

Parked Domain Process

The Parked domain process is the easiest and fastest method, if you are choosing URL structure having each store with different domains. In this process, you’ll claim to have trousers.com and sweaters.com. And trousers.com installed with Magento will be your primary domain.

Set up domain ‘sweaters.com' with following steps:

  • Enter Parked Domains icon, after logging to cPanel of your domain.
  • In the input field, enter the domain name to set-up second store.
  • Select and enter Add Domain tab.
  • In Magento index.php file find the line (the last line of the file):

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

Add the following code right before this :

switch($_SERVER['HTTP_HOST']) {

case 'sweaters.com':

case 'www.sweaters.com':

$mageRunCode = 'sweaters';

$mageRunType = 'website';

break;

}

Are you owning more than two stores ?

If yes, then to the above block, add additional cases:

switch($_SERVER['HTTP_HOST']) {

case 'sweaters.com':

case 'www.sweaters.com':

$mageRunCode = 'sweaters';

$mageRunType = 'website';

break;

case 'sweaters.com':

case 'www.sweaters.com':

$mageRunCode = 'sweaters';

$mageRunType = 'website';

break;

}

Add-on Domain Process

This process takes a little longer time to setup, otherwise having the same scenario as above.

It might be more beneficial to you, if you planned to have a blog on one domain and not on another.

It couldn’t be possible with a parked domain.

Follow the below steps to set-up domain sweaters.com:

  • Enter the Addon Domains, for your domain by logging to cPanel.
  • Enter sweaters.com, as New Domain Name and automatically, cPanel will fill in the next two fields. From the Document Root field, remove public_html/ and it will leave you with sweaters.com. Although, this step is not essentially required, still it makes more sense for organizational purposes.
  • After setting a password for this domain, enter the Add Domain tab.
  • Via SSH, login to your site and enter to the previously set directory in the Document Root field while adding domain. e.g.:

cd sweaters.com/

  • From the directory installed with Magento, copy the index.php and .htaccess file

cp ../public_html/index.php ../public_html/.htaccess .

  • Find this line (the last line of the file), after opening the index.php file :

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

Add the following code, right before this:

$mageRunCode = 'sweaters';

$mageRunType = 'website';

  • Finally, create symbolic links to point some directories:

ln -s ../public_html/app ./app

ln -s ../public_html/errors ./errors

ln -s ../public_html/includes ./includes

ln -s ../public_html/js ./js

ln -s ../public_html/lib ./lib

ln -s ../public_html/media ./media

ln -s ../public_html/skin ./skin

ln -s ../public_html/var ./var

Sub-domain Process

In this method, pretend to own domain.com. As a portal, this setup links to a number of shops within the mall. On the domain.com, Magento will be installed and sub domains will carry all the shops e.g.:

  • trousers.mall.com
  • sweaters.mall.com

Follow the below mentioned steps to set up for the sweaters sub domain:

  • Enter the Sub Domains icon, after logging in to cPanel for your domain.
  • Enter sweaters, for the Sub Domain and cPanel will automatically fill in the next field. From the Document Root field, remove public_html/ to leave with just trousers. Although, this step isn’t essential, it makes more sense for organizational purposes.
  • Enter the Create tab.
  • Via SSH, login to your site and enter the previously set directory in the Document Root field above while creating your sub domain. e.g. :

cd sweaters/

  • From the directory installed with Magento, copy the index.php and .htaccess file in root web directory:

cp ../public_html/index.php ../public_html/.htaccess .

  • Find this line (the last line of the file), after opening the index.php file :

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

Add the following code, right before this:

$mageRunCode = 'sweaters';

$mageRunType = 'website';

  • Finally, create symbolic links to point some directories:

ln -s ../public_html/app ./app

ln -s ../public_html/errors ./errors

ln -s ../public_html/includes ./includes

ln -s ../public_html/js ./js

ln -s ../public_html/lib ./lib

ln -s ../public_html/media ./media

ln -s ../public_html/skin ./skin

ln -s ../public_html/var ./var

Sub-directory Process

This process have the same scenario as above, except all the stores will be in sub-directories, e.g.:

  • domain.com/trousers
  • domain.com/sweaters

Learn with below mentioned steps, how to set up this for the sweaters sub-directory:

  • Via SSH, login to your website to create a sub-directory for your second store:

cd public_html

mkdir sweaters/

cd sweaters/

  • From the directory installed with Magento, copy the index.php and .htaccess file in root web directory:

cp ../public_html/index.php ../public_html/.htaccess .

  • Find the line (the last line of the file) after opening the index.php file :

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

Add the following code, right before this:

$mageRunCode = 'sweaters';

$mageRunType = 'website';

Multiple Stores Management.

As you are managing multiple stores with a single admin panel, so it is very important to make sure that you’re altering the configuration for the respective store.

You can globally change the configuration values of your all individual stores and websites in the System → Configuration section by leaving the drop-down menu for Current Configuration Scope set to Default Config, without removing the check-mark throughout the configuration sections next to Use default.

Using   Multiple-Store In Magento

Presume, you are a sporting apparels company, who sells shoes, clothing for the customers of both formal and casual  wears in multi-languages, then you might consider selling formal and casual apparels on their own website (either you can host these sites under a sub domain, a separate domain or a sub folder is altogether different).

Further, you might consider to create two different stores under the Footwear and clothing websites – one for Formals and another for Casuals.

Store views are generally used with the presented changes for the information, like a language.

Here, at store level you can configure various products, their shipping options and currency, etc.

On using Magento’s multi-store, you will be provided with the benefit that the data remain in a single location and segregated only when the user will be presented with the information.

This will provide you a total flexibility to target a specific segment of customers with marketing and promotion, beside simplifying store management and information.

Checkout Securely For Every Store.

If you have different stores dedicated to hosting environments, despite it is not advisable, still you can choose either parked or addon domain process as discussed above, and then edit httpd.conf file to provide IP address to these parked or add-on domains.

Most likely all these changes are overwritten with upgrade of control panel, PHP or Apache rebuild, and simple maintenance.

As a best-bet, you should purchase multiple or multi-domain certificate also named as UCC (Unified Communications Certificate). After setting up this SSL, you can simply go for parked domain process for your every assigned domain with UCC certificate.

Like this, your online business will surely get benefited by running in a flexible and secured environment. All of your stores will hold their own secure checkout, while still sharing the common back-end and code-base.

Now, navigate to your new store site and verify if the right Magento store is loaded?

If not the same, then make sure the code MAGE_RUN_CODEmatch with the code created before. The domain should resolve to the right folder/path.

On browsing the URL, you should able to view each individual store.

While performing any of the above steps, if you are experiencing any issue, you can always get in touch with us and Hire Magento developer from India to avail our services at a very competitive price!

If you are willing to share any other process or idea to setup and manage domains and multiple stores in Magento with us, then please let us know about it on contact us.

Thanks for reading this blog!

Ellipsis-1s-200px