18

How to create multiple stores with different domains in Magento with same products, same database but different customers.

Example :

I bought 2 domains: mystore1.com and mystore2.com (FYI: mystore1.com already running)

Now I want to add mystore2.com to mystore2.com with same products, same database but different customers.

Notes:

  • Already tested with This Way
  • Please answer step by step !! Bounty for a correct answer. and do not answer with referral link.
  • so is that tutorial which you followed work? if yes: Is your problem related with using different customers for different stores? – Shathish Jun 14 '13 at 6:47
  • i don't want to change index.php. – Josua Marcel Chrisano Jun 14 '13 at 8:09
  • you don't need to change the main index.php, you should only change the index.php of mstore2. You can try the tut linked by Marius – Shathish Jun 14 '13 at 9:29
  • correct @Shathish . It's already established, but now the problem is : "NetworkError: 404 Not Found - mystore2.com" – Josua Marcel Chrisano Jun 14 '13 at 10:26
  • is mystore2.com working independently? if it works, then the problem may be with .htaccess, which u configured – Shathish Jun 14 '13 at 10:42
29

Preconditions
Magento already created a default website on installation (in your case mystore1.com).
Step 1 - Creation
Go to System->Manage Stores. Click on Create Website. Fill in the the form with desired values and save. Example:

  • Name - Website 2
  • Code - site2
  • Sort Order: 2

Click on Create Store. In the form fill in the values and save. Example:

  • Website - Website 2 (the one you created previously)
  • Store for website 2
  • Root Category - Default Category (same as the store in mystore1.com)

Click on Create Store View. In the form fill in the values and save. Example:

  • Store
  • Name - store for website 2 (the one you created above)
  • Code - store2
  • Status - Enabled
  • Sort Order - 1

So far you have created a new website.
Step 2 - Configuration
Go to System->Configuration->Web->Unsecure. From the top left dropdown select 'Website 2' (the website not the store view) and fill the following value.

  • Base URL : http://www.mysite2.com/
  • Base Link URL: {{unsecure_base_url}}
  • Base Skin URL: {{unsecure_base_url}}skin/
  • Base Media URL: {{unsecure_base_url}}media/
  • Base JavaScript URL: {{unsecure_base_url}}js/ If some of them are already like that, leave them that way.

If you plan to use SSL on your website you should do the same on the Secure section but fill in the secure url of your website for 'Base URL'.

  • Base URL : https://www.mysite2.com/
  • Base Link URL: {{secure_base_url}}
  • Base Skin URL: {{secure_base_url}}skin/
  • Base Media URL: {{secure_base_url}}media/
  • Base JavaScript URL: {{secure_base_url}}js/

Save the changes and clear the cache.

Step 3 - Server configuration
Now you have to make the document root of mysite2.com point to the same folder as mysite1.com.

Add this to your httpd.conf file

<VirtualHost *:80>
    ServerAdmin webmaster@mysite2.com
    DocumentRoot /document/root/here
    ServerName mysite2.com
</VirtualHost>

Now when you visit mysite2.com you will see the same homepage as mysite1.com but the first click you make will take you to mysite1.com.
To fix this add the following to .htaccess.

SetEnvIf Host www\.mysite1\.com MAGE_RUN_CODE=base #or the code for mysite1.com
SetEnvIf Host www\.mysite1\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^mysite1\.com MAGE_RUN_CODE=base #or the code for mysite1.com
SetEnvIf Host ^mysite1\.com MAGE_RUN_TYPE=website

SetEnvIf Host www\.mysite2\.com MAGE_RUN_CODE=site2 #or the code for mysite1.com
SetEnvIf Host www\.mysite2\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^mysite2\.com MAGE_RUN_CODE=site2 #or the code for mysite1.com
SetEnvIf Host ^mysite2\.com MAGE_RUN_TYPE=website

Restart the server, clear the cache again just in case (contents of var/cache) and you should be ready.

In case I missed something you can check this tutorial that basically says the same things.

[EDIT]
After configuring the new website, in order to separate the customers go to System->Configuration->Customer Configuration->Account Sharing Options and set the value for Share Customer Accounts to Per website.

protected by Community Jul 6 '17 at 20:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.