0
votes

I have two domains:

DomainA.nl (with magento installation)

DomainB.nl (nothing installed; just a public_html folder with a .htaccess file)

DomainB.nl :

Content of the .htaccess file on DomainB.nl:

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.DomainA\.nl

RewriteRule (.\*) http://www.DomainA.nl/$1 [R=301,L]

Above works; it succesfully redirects to DomainA

DomainA :

This is the domain with the Magento installation. With;

  • 1 website
  • 2 stores

    • Store 1 has two storeviews
      • 1: code = "mbv_nl" (DEFAULT STORE VIEW)
      • 2: code = "mbv_en"
    • Store 2 has one storeview
      • 1: code = "test_nl"

Index.php on DomainA :

This is the content of the LAST lines of the index.php file on DomainA

     /* Store or website code */
     $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

     /* Run store or run website */
     $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

     switch ($_SERVER['HTTP_HOST']) {
         case 'DomainB.nl':
         case 'www.DomainB.nl':
             $mageRunCode = 'test_nl';
             $mageRunType = 'store';
             break;      
         default:
             $mageRunCode = '';
             $mageRunType = 'store';
             break;
     }


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

THE QUESTION: The redirect works BUT it redirects to the DEFAULT store view.

In the 'switch-case' scenario i know the default case is not necessary because the $mageRunCode and $mageRunType are already declared. I put it in for testing. Because when i fill the default case with "mageRunCode = 'test_nl'" the storeview gets loaded.

I am out of knowledge, so any help is VERY welcome :)

1

1 Answers

0
votes

I have solved it on another way. Instead of using the parked domain method I used the Addon Domain method. So i created a subdomain on the "Magento-domain". This method is also explained on this website: http://www.crucialwebhost.com/kb/how-to-setup-multiple-magento-stores/#addon-domain-method

The above method works. But i feel the other method (in my question) is better so i will keep my eyes open for a solution. For now i will rest with this solution...