0

I have three different websites and within one website three stores on a single Magento 1.9 installation.

 1. www.domain1.com
 2. www.domain2.com
 3. www.domain3.com

Each domain contains three store views. What I want are the following base urls for each store,

For domain 1,

  • www.domain1.com/in
  • www.domain1.com/intl
  • www.domain1.com/rw

For domain2,

  • www.domain2.com/in
  • www.domain2.com/intl
  • www.domain2.com/rw

And for domain3,

  • www.domain3.com/in
  • www.domain3.com/intl
  • www.domain3.com/rw

How can I achieve this? When I enable add General > Web > Url Options > Add Store Code to Urls to true the store codes are added to the url. That is perfect. But, I can't have duplicate store codes. So, I cannot define store code "in" twice or more. Similarly, for the rest of the two cases. Can anyone guide me how to achieve the desired result?

0

Open index.php in any text editor

Look for the following line near the bottom of the file:

Mage::run($mageRunCode, $mageRunType);

Add the following lines right above this line:

switch($_SERVER['HTTP_HOST']) {
    case 'domain1.com':
    case 'www.domain1.com':
        $mageRunCode = 'domain1_com';
        $mageRunType = 'website';
    break;
    case 'domain2.com':
    case 'www.domain2.com':
        $mageRunCode = 'domain2_com';
        $mageRunType = 'website';
    break;
}

Replace the domain, code and type according to your particular setup. Add additional case statements if you have more stores.

  • I don't think this addresses my question. I have no issues with loading different stores. That I am already doing. What I need is the base urls for all the stores that I have mentioned in my question. Please go through my question once. – Nasir Perwaiz Aug 9 at 6:20
0

I have this way Try,Please Try this and let me know in case of any issue.

1). Created three folders i.e "in", "intl" and "rw" in the root directory.

2). Copied .htaccess and index.php from the root directory to all the three folders.

3). Modified .htaccess and put "RewriteBase /in/" "RewriteBase /intl/" and "RewriteBase /rw/" in the respective folders.

4). Modified index.php file inside the sub folders "in", "intl" and "row" .

if ( $_SERVER['HTTP_HOST'] == 'www.domain1.com' || $_SERVER['HTTP_HOST'] == 'domain1.com') {
    $code = domain1_store_code_for_india;
} elseif ($_SERVER['HTTP_HOST'] == 'www.domain2.com' || $_SERVER['HTTP_HOST'] == 'domain2.com') {
    $code = domain2_store_code_for_india;
} elseif ($_SERVER['HTTP_HOST'] == 'www.domain3.com' || $_SERVER['HTTP_HOST'] == 'domain3.com') {
  $code = domain3_store_code_for_india;
}

  Mage::run($code, 'website');

Replicated this on all the three folders.

  1. Finally, set base URLS from the backend `

System->Configuration->General->Web->Secure->Base URL

to

https://www.domain1.com/in/

https://www.domain1.com/intl/

https://www.domain1.com/rw/

Many Thanks.

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.