0

I deployed Magento 2.1 on console.google Is there anybody who succeded to deploy multiple websites with different domains?
Magento2: How to create multiple storefronts does not works for Magento 2.1

I am sure many people suffer the same issue?

There is not any answer to similar question for Magento 2.1 on link How to setup another domain/website on the same Magento 2.1.0 installation? (updated)

1

I got it:

In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:

require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'websitecode';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:

ln -s /path/to/your/install/public_html/m2/app/ app 
ln -s /path/to/your/install/public_html/m2/lib/ lib 
ln -s /path/to/your/install/public_html/m2/pub/ pub 
ln -s /path/to/your/install/public_html/m2/var/ var 

After we added the latter, everything seems to work fine, so far.

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.