cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Multi-store Setup Help

Magento 2 Multi-store Setup Help

I've read through the Magento 2 multistore help guide in a bid to understand it, but it is a bit too much for me to take in so I need a little help dumbing it down.

 

Essentially what I am trying to achieve is:

  • A single domain with two stores (one targeting UK/EU and the other USA/Canada)

For SEO purposes the USA/Canada stores needs to be a subdirectory, not a subdomain. i.e.

UK/EU: www.domain.com (primary)

USA/Canada: www.domain.com/us (subdirectory)

 

  • Both stores will use the same domain, layout, artwork, etc. but will have minor differences, i.e. different contact forms (also secured by the same SSL).
  • Each store will have its own currency, payment and shipping methods.
  • Ability to create one product listing and select which of the two stores the product will appear in (or both) - this should avoid duplicate content issues and means I don't need to create the same product twice.
  • Have separate inventory management for each store.
  • Ideally have separate order management for each store.

 

I have GeoIP installed on the site at the moment, so having customers redirected to the correct site won't be a problem.

 

  1. Are these features built-in to Magento 2 or will I require modules?
  2. How do I achieve my desired setup and is there anything I should know?

 

PS: I will probably also make two further stores (but with a lot less products and a different layout):

UK/EU Wholesale: www.domain.com/wholesale(subdirectory)

USA/Canada Wholesale: www.domain.com/us/wholesale(subdirectory)

 

11 REPLIES 11

Re: Magento 2 Multi-store Setup Help

First You need to create sub-folder like us in Magento root.

then copy the Index.php and .htaccess from root to this sub-folder.

update Index.php in sub-folder

 

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);

 

with below code

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'your_store_code'; 
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

 

Then, set the store URL as for sub-folder and

what’s most important – set base URL for static view files to:

domain.com/pub/static

and base URL for media to

domain.com/pub/media

Where domain.com is of course your main domain name for the store.

You can repeat same above step for all new stores like wholesale etc.

 

 

Re: Magento 2 Multi-store Setup Help

Thank you very much for taking the time to reply!

 

I have done the first part with creating the subfolders and stores but I'm not sure what exact steps to take here:

 

what’s most important – set base URL for static view files to:

domain.com/pub/static

Is this setting in the Configuration section of the Admin panel?

 

and base URL for media to

domain.com/pub/media

 

I'm not entirely sure what this means. I should probably point out that I'm not a developer, I'm new to Magento (having moved over from Opencart).

Re: Magento 2 Multi-store Setup Help

Hi,

what’s most important – set base URL for static view files to:

domain.com/pub/static

means when you set admin URL configuration in Store > Configuration  > General  > Web  > Base URLs  section

For Base URL put subfolder domain URL like  www.domain.com/us but for other static URL must put the main domain URL only not with sub-folder URL
like check below screenshot
http://prntscr.com/mqswnw
http://prntscr.com/mqsyrd

Hope this will help you.

Thanks

Re: Magento 2 Multi-store Setup Help

Hello,

 

Thanks for taking the time to reply. So are you saying that I need to change the below to actual URLs and then change the base URL? Or is the below fine so long as the actual subdirectory is correct (i.e. subdirectory is www.domain.com/us). I just want to be clear before I change the base URL.

Screen Shot 2019-02-27 at 15.27.48.png

 

Re: Magento 2 Multi-store Setup Help

Yes first you need to select your particular store like US store and then update URL like below screenshot.
https://prnt.sc/mqsyrd

Re: Magento 2 Multi-store Setup Help

Thank you. I attempted this action but received the below error.Screen Shot 2019-03-01 at 12.43.50.png

 

Re: Magento 2 Multi-store Setup Help

Has anyone experienced this?

Re: Magento 2 Multi-store Setup Help

Has anyone encountered this issue and been able to fix it?

Re: Magento 2 Multi-store Setup Help

For anyone else having this issue I figured it out. I had to add / at the end of the URL.

 

i.e.

www.domain.com/us-wholesale/