Showing results for 
Search instead for 
Did you mean: 

Multi Shop


Multi Shop

Hello everyone,

I would like to figure out how I can create a multistore with a single installation of magento 2.
I created a website, a store and a view associated with it.

Then in Store/Configuration/Web I set the base url for the new store view as

but calling this url me error 404.

Where am I wrong?


Sorry for the English.

Thank you

Tags (2)

Re: Multi Shop

thanks for the reply.


I did it this way:

1. I created a domain and I do point to the same directory domain (/var/www/

2. I then created from the administrative panel a "website" called "" code (magentotestb2b)
3. I then created a "store"
4. I then created a "store view" code (b2b)


all it is according as it is written on the guide that you have shown me.


At this point I went Stores -> Configuration -> Web (always from the administrative side) and selected as a store view " and I made these settings:


1. Base URL:
2. Secure Base URL:


Finally in my .htaccess after this line of code:


 # RewriteBase/Magento/


I included this:


    RewriteCond %{HTTP_HOST} ^(.*)magentotestb2b\.it
    RewriteRule .* – [E=MAGE_RUN_CODE:magentotestb2b]
    RewriteCond %{HTTP_HOST} ^(.*)magentotestb2b\.it
    RewriteRule .* – [E=MAGE_RUN_TYPE:website]

but when I call via url this domain:

It makes me the redirect to this:

thus always showing the same content.


Where am I wrong?

Thank you

Re: Multi Shop

How to set MAGE_RUN_CODE and MAGE_RUN_TYPE to an Apache webserver:

Re: Multi Shop

OK thanks.

I solved this way:
in index.php I commented this part:


$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');

and I added this:


$params = $_SERVER;
 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'magentotestb2b';
 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
 $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
 $app = $bootstrap->createApplication('Magento\Framework\App\Http');

at this point it makes him redirect automatically and display the correct content.

Thank you