cancel
Showing results for 
Search instead for 
Did you mean: 

Help with index.php and multistore setup.

Help with index.php and multistore setup.

Hi all, I'm not a developer so please be simple with response, I'm the website manager for the companies who's website it is.

We have had a new M2 multistore setup built and are experienancing a large number of issue. We are being told by our developers the setup is correct, but having had a 3rd parter Magento partner developer review the setup they have confirmed my views that the muiltstore isn't right. We have a hugh number of issues with 404, 503, some 25K url rewrites within M2 CMS.

Starting from the foundations we've been told the index.php and multistore setup is wrong. Can someone please reviews the index.php code below and tell be if this is correct?

---------------------

<?php
$url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];

if($url == "abbuildingproducts.co.uk/") {
	header('Location: https://www.abbuildingproducts.co.uk/GBR');
	die();
}

if($url == "www.abbuildingproducts.co.uk/") {
	header('Location: https://www.abbuildingproducts.co.uk/GBR');
	die();
}

if($url == "abbuildingproducts.com.au/") {
	header('Location: https://www.abbuildingproducts.com.au/aus');
	die();
}

if($url == "www.abbuildingproducts.com.au/") {
	header('Location: https://www.abbuildingproducts.com.au/aus');
	die();
}

/**
 * Application entry point
 *
 * Example - run a particular store or website:
 * --------------------------------------------
 * require __DIR__ . '/app/bootstrap.php';
 * $params = $_SERVER;
 * $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
 * $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::class);
 * $bootstrap->run($app);
 * --------------------------------------------
 *
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

#$_SERVER['MAGE_PROFILER'] = 'html';

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

 

------------------------

 

Cheers Geoff