cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Store Setup in Magento 2 - Help Needed

Multi Store Setup in Magento 2 - Help Needed

I have set up Magento and set up 2 stores in the admin, base urls, etc - that part I have no problem with, but I'm struggling with how to actually get the 2nd store to run.

 

So say I have

 

www.store1.co.uk/shop/

www.store.2.co.uk/shop/

 

www.store1.co.uk/shop is the default (main store) which works fine.

 

What I'm struggling with is how to get the second store to run on www.store2.co.uk/shop

 

It is not an add-on domain, isn't in a sub-directory  - it is a separate web site on the same server.  Everything I find online seems to assume it's an add-on domain, etc rather than a totally different site.

 

I've put in index.php at www.store1.co.uk/shop

 

$params = $_SERVER;

switch($_SERVER['HTTP_HOST']) {

case 'store1.co.uk/shop':
case 'www.store1.co.uk/shop':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'base';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;


case 'store2.co.uk/shop':
case 'www.store2.co.uk/shop':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'store2';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
}

which tells magento which store to run depending on which url the visitor is loading the store from?

 

But obviously something at www.store2.co.uk/shop needs to connect to magento installed at www.store1.co.uk/shop and display this in the browser and this is where I'm struggling.  I'm guessing the .htacess file under www.store2.co.uk/shop needs to be set to tell the browser to connect to www.store1.co.uk/shop?

 

Can anyone tell me exactly what I need to do to www.store2.co.uk/shop to get this to work please?