2

I am posting here after 2 days trying different methods for the Multiwebsite Setup. I am upgrading my website from Magento 1.9 to 2.3. Since my previous Magento 1.9 had some structural issues, I decided to start with a fresh install and adding the products again (30 - 40).

Since my current Magento 1.9 website is still live and using PHP5.5, I created a separate subdomain using Cpanel WHM and the same uses PHP7.2

There are 3 websites in picture www.kkeautocare.com (default) www.kkeautocare.ca www.kkeautocare.in

The test location is shop.kkeautocare.com

Since www.kkeautocare.ca is not much advertised one, I thought of linking it to shop.kkeautocare.com for testing.

when I access www.kkeautocare.ca it gives a broken theme (without CSS) while if i access www.kkeautocare.ca/?1 , the theme looks okay but with following in the head tag. All the URLs are of shop.kkeautocare.com which is the default website.

<script>
    var BASE_URL = 'http://shop.kkeautocare.com/';
    var require = {
        "baseUrl": "http://shop.kkeautocare.com/pub/static/version1550965856/frontend/Smartwave/porto/en_US"
    };
</script>

It is worthwhile mentioning here that just to check if it is going to the right website, I changed the www.kkeautocare.ca Theme to default Luma instead of Porto on shop.kkeautocare.com .

I Have added the following code in index.php :

$params = $_SERVER;
$domain2store = array(
    'shop.kkeautocare.com'=>'base', // Replace your Website, Store or Storeview code with this.
    'kkeautocare.ca'=>'CA',      // Replace your Website, Store or Storeview code with this.
    'www.kkeautocare.ca'=>'CA',      // Replace your Website, Store or Storeview code with this.
    );

if(isset($domain2store[$_SERVER['HTTP_HOST']]))
$storecode = $domain2store[$_SERVER['HTTP_HOST']];
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = isset($storecode) ? $storecode : '';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';

Can somebody help? Comment me if you need any clarification.

  • Got it working by adding index.php – Kangaroo Mar 1 at 1:20
  • if ($_SERVER['HTTP_HOST']=="www.kkeautocare.in") $_SERVER["MAGE_RUN_CODE"] = "IN"; if ($_SERVER['HTTP_HOST']=="kkeautocare.in") $_SERVER["MAGE_RUN_CODE"] = "IN"; if ($_SERVER['HTTP_HOST']=="www.kkeautocare.ca") $_SERVER["MAGE_RUN_CODE"] = "CA"; if ($_SERVER['HTTP_HOST']=="kkeautocare.ca") $_SERVER["MAGE_RUN_CODE"] = "CA"; $_SERVER["MAGE_RUN_TYPE"] = "website"; – Kangaroo Mar 1 at 1:20

Your Answer

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

Browse other questions tagged or ask your own question.