nopCommerce provides you with the ability to create multiple storefronts to sell products online. Being able to experience this on your localhost is simple to do and requires only a few steps.
I will show you how to create 2 stores (store1.com and store2.com) in the following steps:
Edit your hosts file
Using your favorite text editor (I am using Notepad++ in this example), locate and open your hosts file. This file is located in the “c:\windows\system32\drivers\etc” directory. When editing this file, make sure you are using “Run as administrator” privileges. Here is what my hosts file looks like:
As you can see, I have uncommented the line beginning with my localhost address (127.0.0.1) and added 4 new entries for store1.com and store2.com. Save your hosts file.
Lets move on to the next step.
Setting up multiple hosts in IIS
An IIS site can have multiple hosts pointing to it. What we want to do is create a site pointing to our code base so that can point the multiple stores to it.
Open Internet Information Services (IIS) Manager and create a new Site. Make sure the location of the site is pointing to the location of your current code base for your Nop.Web.
Next, select right-click your site and select Edit Bindings.
Add the store1.com and store2.com bindings.
Add a new store in nopCommerce
Log into your existing nopCommerce store. My existing store is located at http://localhost/ncPortal. Yours may be located at http://localhost:some_random_port. Just log in as an Administrator and create 2 new stores.
When you are finished, you should have a total of 3 stores.
Test your new multi-store environment
Now to test! Open your favorite browser and navigate to http://www.store1.com. Scroll down to the bottom of the page and witness the miracle!
If you find that you are not able to pull up your nopCommerce store(s), try resetting your DNS cache on your computer.
- Run cmd.exe as an administrator
- Type: ipconfig /flushdns
- Retry navigating to http://www.store1.com
Thank you!
Kirstie says
Thanks for the great article.
After following your article literally I was getting a 403 error. It took me an hour to figure out what was wrong! Upon creation of the nopStores site it also creates a corresponding application pool and this by default points to the 2.0 framework.
Go to Application Pools
-> Select Application pool for nopStores site
-> Double click on it and set .Net Framework Version to 4.0
RRR says
I did as is but no luck