1

I'm trying to add a second store to my existing Magento installation (1.8.1.0).

The existing instance sits on https://subdomain1.url.com, Within Magento, website code is base, store view code is default

The 2nd instance is to sit on http://subdomain2.url.com, Within Magento, Website code is 2ndstore, store view code is 2ndstore_sv

I have amended the configuration within Magento so that the new subdomain is configured for the store (System -> Configuration -> Web -> Base URL)

I have set up subdomain2 within cPanel and the root is pointing to subdomain1

Within the htaccess file I have the following:

RewriteCond %{HTTP_HOST} ^(.*)subdomain2.url.com
RewriteRule ^ - [E=MAGE_RUN_CODE:2ndstore_sv]

Yet when I type http://subdomain2.url.com into the browser I end up at https://subdomain1.url.com

Any suggestions on where I am going wrong?

0
  1. You should point the DNS of the second store to https://subdomain2.url.com and add the alias in your Vhost.

  2. Add this in your .htaccess

    SetEnv MAGE_RUN_TYPE website
    SetEnvIf Host subdomain1\.url\.com MAGE_RUN_CODE=domain1
    SetEnvIf Host subdomain2\.url\.com MAGE_RUN_CODE=domain2
    
  3. Add the code bellow in your index.php above this: Mage::run($mageRunCode, $mageRunType);

    switch($_SERVER['HTTP_HOST']) {
        case 'subdomain1.url.com':
        case 'www.subdomain1.url.com':
            $mageRunCode = 'domain1';
            $mageRunType = 'website';
        break;
        case 'subdomain2.url.com':
        case 'www.subdomain2.url.com':
            $mageRunCode = 'domain2';
            $mageRunType = 'website';
        break;
    }
    
  • Excellent, all working now, thanks for the help – curtisc Nov 9 '17 at 15:03
  • You're welcome :) please accept the answer. – PЯINCƏ Nov 9 '17 at 15:08

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.