cancel
Showing results for 
Search instead for 
Did you mean: 

Multistore URL Setup

Multistore URL Setup

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.

 

store2_url.PNG

 

I have then created the sub folder inside the root of my Magento2 installation as shown below.

 

biz_folder.PNG

 

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.

 

<?php

	require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'base_business';
$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);

try {
    require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
    echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
        <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
        Autoload error</h3>
    </div>
    <p>{$e->getMessage()}</p>
</div>
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 bisit 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

2 REPLIES 2

Re: Multistore URL Setup

Exactly the same problem, 

did you manage to get it sorted? any ideas?

Re: Multistore URL Setup

Unfortunately I didn't ever get this issue resolved.

 

I resorted to simply installing a second Magento2 instance on store.com/business,

 

Only way I could do it.

 

Regards, Paul