cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Shop

SOLVED

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 http://www.test.it/b2b/

but calling this url me error 404.

Where am I wrong?

 

Sorry for the English.

Thank you

Tags (2)
4 REPLIES

Re: Multi Shop

thanks for the reply.

 

I did it this way:

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

2. I then created from the administrative panel a "website" called "magentotestb2b.it" 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 "magentotestb2b.it and I made these settings:

 

1. Base URL: http://www.magentotestb2b.it/
2. Secure Base URL: https://www.magentotestb2b.it/

 

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:

http://www.magentotestb2b.it/

It makes me the redirect to this:

http://www.magentotest.it/

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: https://mage2.pro/t/560

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');
$bootstrap->run($app);

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');
 $bootstrap->run($app);

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

Thank you