Magento 2 – Create Multiple Storefronts

magento2multistorewebsites

I'm trying to create new store & website which will run at http://127.0.0.1/lapis/in/. Here is the process I've followed.

1. Created new store, website and store view named Indian Store, Indian website & Indian Store view respectively with website code in.
2. In Stores->Configuration->Web changed website URL to http://127.0.0.1/lapis/in/.
3. Assigned category at products->Categories after switching store view to Indian Store view.

  1. Created folder named in inside root magento installation with 2 files index.php and .htaccess with following code
    index.php code inside in directory
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'in';
$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);
  1. Copied .htaccess root file inside in directory and added
    RewriteBase /in/
    Now when I'm navigating to http://127.0.0.1/lapis/ , it works fine but http://127.0.0.1/lapis/in/ throws 500 server error.
    I'm missing something here or my process of creating new website is wrong?

Best Answer

  1. In $app = $bootstrap->createApplication('..\Magento\Framework\App\Http'); $bootstrap->run($app); you should not use '..', as it's class name
  2. I'd also suggest to check your web server logs to better understand the issue.