Paid Media

Developer's Toolbox: Using Store Views in Magento

Sep 04, 2012   •   3 Min Read

Recently I have been working with a client to create additional store views as they expand their international presence. During the project, I realized that available information regarding this process is unreliable and decided to make it the topic of my newest blog post. In this entry we will cover creating a new store view in Magento, determine when a new website instance is required, and review different methods to configure your server to run the store.

Configure Magento

Believe it or not, this step is the easiest part of the process. From the Magento admin panel navigate to the System->Manage Stores.


At this point, you need to decide what you want from your new store. If you only want to display a new language you can skip ahead to the Create Store View section. If you are interested in changing product prices or plan on adding new products just for this store view you will need to create a new website and store in your Magento instance.

Create Website

This will create a new website on your Magento instance. In this page you will need to enter a name for the new website, a code, and the sort order. The store name is self explanatory, the code is used by Magento to identify the website, and the sort order is used by the system to order all websites in the instance.


Create Store

This section assigns a root category to the website. The store requires a website and a root category to be selected and a name to be provided.


Root categories are the uppermost levels in a category hierarchy. If you wish your new store to have a different category structure you will need to create a new root category by going to Catalog->Categories->Manage Categories.


Create Store View

This is the lowest level of the Magento store hierarchy. Most Magento data, including categories and products, can be edited at this store view level. For a store view to be created it needs to be assigned to an existing store, and a unique name and store needs to be provided. In addition, this page allows store views to be enabled and disabled as needed.


Modify Store Url

Now that your store has been created, you need to tell Magento what the new store url should be. Navigate to System->Configuration, select the ‘Web’ page, and change the Current Configuration Scope to the new website (if you only created a new store view change the scope to that view). Make sure to uncheck the checkbox next to the Base URL and Secure URL and enter the new store’s address.


Implement New Package/Theme

If you want to use a new theme for your store view, navigate to System->Configuration and select the ‘Design’ page. Make sure you are in the correct configuration scope and modify the Package and/or Theme values to use your new design.


Webserver Configuration

Now that Magento knows everything it needs to, we need to determine how to configure your webserver. There are two popular methods being used by storeowners, using secondary domains and separate directories or pointer domains and .htaccess rules.

Secondary Domains

To use this you need to create a new directory and configure the server to send new url calls to that directory. Next, you will need to create a series of symlinks to the primary Magento instance. The following commands assume the current directory is the new store’s base directory and the primary Magento instance is one row above.

ln –s ../app app

ln –s ../includes includes

ln –s ../js js

ln –s ../lib lib

ln –s ../media media

ln –s ../skin skin

ln –s ../var var

In addition, you need to copy the .htaccess and index.php files from the base directory to the new directory. And finally, the final line of the new index.php file needs to be modified to use the new website code.

Mage::run(‘site_code’, ‘website’)

If you only created a store view, the line of code should actually be:

Mage::run(‘store_view_code’, ‘store’)

Pointer Domains

There are two ways to implement the pointer domain method. The first is very simple and uses the SetEnvIf directive to change variables in the index.php file. The second involves using RewriteCond and RewriteRule in the .htaccess file.

SetEnvIf Implementation

Add the following two lines just below the ‘RewriteEngine On’ line:

SetEnvIf Host .*newDomain.* MAGE_RUN_CODE=site_code

SetEnvIf Host .*newDomain.* MAGE_RUN_TYPE=website

Rewrite Implementation

Add the following code just below the RewriteBase /Magento line:

RewriteCond %{HTTP_HOST} .*newdomain\.com [NC]

RewriteRule .* - [E=MAGE_RUN_CODE:site_code]

RewriteCond %{HTTP_HOST} .*newdomain\.com [NC]

RewriteRule .* - [E=MAGE_RUN_TYPE:website]

If you are attempting to use the pointer domains method but only created a new store view, change the MAGE_RUN_CODE to the store view code and MAGE_RUN_TYPE to ‘store’.


To recap, we’ve run through the process of creating new store instances in the Magento system and walked through the steps required to configure the webserver. You should have everything they need to properly use the store functionality in Magento. If you have followed these steps and are still having problems getting your store to render properly feel free to post a comment below and I will do what I can to help.

To learn more on Magento website design and development read my last blog on the Price Rules in Magento where you will find a walkthrough explaining the functionality behind both shopping cart and catalog price rules.

Questions? We can help. Fill out the contact form below to get answers to any questions you have about Magento.

Explore more tags: Paid Media Blog
Related Content

You Also May Like


BigCommerce Feedonomics: A Framework for Omnichannel Growth

When selling products across multiple eCommerce platforms, strategic visibility and...
Learn More

15 Shopify Website Examples To Inspire eCommerce Site Design in 2024

At Groove, we work with several eCommerce platforms, and Shopify is one of the most...
Learn More

Use The HubSpot Shopify Integration To Sync Customer Data

Introduction Running an online store is full of day-to-day excitement, but the data...
Learn More

Klaviyo Abandoned Cart: 5 Strategies to Increase Conversion

It takes a lot of work to get customers to your eCommerce store. Whether you use SEO...
Learn More

Omnisend vs Klaviyo: A Marketer's Perspective on the Best Choice

One of the main factors to consider when growing your brand is choosing an email...
Learn More

Klaviyo Email Marketing: 5 Reasons They Stand Out in 2024

In 2024, email marketing is far from dead. Contrary to popular belief, it continues...
Learn More
20 Best Shopify Apps LP Background Small

20 Best Shopify Apps For Your eCommerce Store

Download e-Book

Let's Grow Your eCommerce Business, Together.