1

I have a website in Magento 1.9 called www.example.com. In Magento, we know that we can create multiple websites so I have created like that multiple websites with their own store and store view. so I have the site.

example.com(default)
example.com(2)
example.com(3)
example.com(4)

My requirement is I need to switch to these websites by staying the same URL (www.example.com). Can any one help me to do this?

  • Without changing the URL, how can you imagine multiple websites? – Mohit Kumar Arora Jul 24 '17 at 11:39
  • @ Mohit Kumar Arora in magento backend how we switching to website the same method i'm asking for – Amith Jul 24 '17 at 11:42
  • For the front end, multiple websites mean different session and different URL per website. I don't think multiple websites can be served from a single URL in frontend. – Mohit Kumar Arora Jul 24 '17 at 12:19
1

After some experiments i have found the solution.You can pass the website code in get parameter and on the basis of that code run the website in index.php. This way your url will not be changed and also set a session for website code.

if (isset($_GET["website"])){
   $web=$_GET['website'];
}

if($web=="clt")
{
   $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? 
   $_SERVER['MAGE_RUN_CODE'] : 'clt';
   $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';
   Mage::run('clt', 'website');
}
  • Great adarsh.... – Amith Aug 2 '17 at 5:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.