Magento2 - Setting up 2 websites on 1 domain inside subfolder.

Avatar
  • Answered
Hello, Im having some difficulties. This is what i am aiming to acheive: Store 1: www.mystore.com/ Store 2: www.mystore.com/business/ I have set the new website/store/storeview up in the backend of Magento with the settings as shown below: Base URL - http://mystore.com/business/ Base Link URL - http://mystore.com/business/ I have then created the sub folder 'business' inside the root of my Magento2 installation. I have then copied both 'index.php' & 'htaccess' files from the root and placed them inside the 'business' subfolder. Inside the index.php. 'base_business' was the code i used when creating the second website inside Magento2 as shown below. --------------------------------------------------------------------------------------------------------------------------------------------------- createApplication('Magento\Framework\App\Http'); $bootstrap->run($app); try { require __DIR__ . '/app/bootstrap.php'; } catch (\Exception $e) { echo <<

Autoload error

{$e->getMessage()}

HTML; exit(1); } $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); /** @var \Magento\Framework\App\Http $app */ $app = $bootstrap->createApplication('Magento\Framework\App\Http'); $bootstrap->run($app); ------------------------------------------------------------------------------------------------------------------------------------------ I have also added the following code just under Rewrite Engine ON inside the Htaccess file. ############################################ ## enable rewrites Options +FollowSymLinks RewriteEngine on SetEnvIf Host .*mystore.com/business* MAGE_RUN_CODE=base_business SetEnvIf Host .*mystore.com/business* MAGE_RUN_TYPE=website ############################################ ----------------------------------------------------------------------------------------------------------------------------------------------------- But after all this when i goto visit the website at www.mystore.com/business I get some kind of error saying this file cannot be found : Fatal error: Class 'Magento\Store\Model\StoreManager' not found in /home/mystore/public_html/business/index.php on line 4 Please can anybody help and see if i have missed something out or done anything wrong. This is the guide which i have been trying to follow. http://devdocs.magento.com/guides/v2.1/config-guide/multi-site/ms_apache.html Magento2 - 2.1.1 Many thanks, Paul T
Avatar
Scott
Hello Paul,

Sorry to hear you are having issues with your Magento stores in the subfolder. The error is having trouble finding the class 'Magento\Store\Model\StoreManager'. Did you create and install a full second instance in the /business folder? Or did you only copy the files mentioned? You will have more success with a full install in the subfolder.

Kindest Regards,
Scott M