One Magento installation with two websites, on separate vhosts

I have a client that maintains two different websites, each configured as a separate virtual host in Apache. I have installed and configured Magento store on one host at 1.com/store domain. Now the customer wants to create a store in domain2.com / store that shares products with the store on the domain.

All of the instructions I've seen for setting up multiple websites in Magento require different websites to be on the same host. Unfortunately this is not an option with our current setup. What's the best way to implement this?

+3


source to share


2 answers


So, I think you should first think about your structure and what you are trying.

1.) Magento supports multi-step solution. To do this, you create many stores in one copy. Then you can set up Magento storage in your vhost file using SET ENV or directly in the file index.php

like this:

switch($_SERVER['HTTP_HOST']) {
    case 'domain1.com':
        $_SERVER["MAGE_RUN_CODE"] = "domain2";
        $_SERVER["MAGE_RUN_TYPE"] = "store";
    break;
    default:
        $_SERVER["MAGE_RUN_CODE"] = "domain1";
        $_SERVER["MAGE_RUN_TYPE"] = "store";
    break;
}

      

You need to change the index.php file that Magento knows which store to call (create stores in Magento config).



2.) . When you need more hosts Then create one database. Install a store with all sites and then copy them to a new location. In the new location, you can set up the store using the snippet in step 1.

Then you can create many hosts with one database, but if you want with one administrator and one database.

When you create the second solution, you should be thinking about the database server being on the same network. Otherwise, you will get very poor performance.

+2


source


You must point both Vhosts to the same magento installation

Then in the section backend/admin

add a separate "Store"? Magento is completely designed for this:



See here

You can share store stocks or store them separately. You can also share the main files Template

- or keep them separated ... Share Skin

files - or keep them separated. Point both vhosts to the same installation directory and let Magento do the job it was created for, without having to do the cumbersome task of Server Administration

splitting the two installations by domain, but with the same Install

.

0


source







All Articles