I have a problem. I cannot make a second store view operate with its own domain.

I am on a shared host in New Zealand and my web host is scratching their head and steering back at me when I mention magento.

Domain A.com (for international customers) on store A works perfectly. This is the domain setup and hosting Magento.

Domain B.com.au is pointing and aliased to A.com, if I go to B.com.au I get the homepage of A.com but showing B.com.au in address bar and from there I can add /au (store code) and browse the correct store.

My knowledge is at a beginners level but I have truly tried everything suggested via google.

It is possible I'm putting something in the wrong place, there is a lot that I'm not familiar with completely, or possibly my host is rubbish and doesn't have the right setup on their part.

Does anyone know what might be preventing me from using either the SetEnvIf Method?

SetEnvIf Host www\.domain1\.com MAGE_RUN_CODE=domain1_com
SetEnvIf Host www\.domain1\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain1\.com MAGE_RUN_CODE=domain1_com
SetEnvIf Host ^domain1\.com MAGE_RUN_TYPE=website
  • Can you confirm you are on an Apache server? Dec 9, 2014 at 20:17
  • Have you tried to swap around the domains to see if it is an issue with the code? Dec 9, 2014 at 21:08
  • Yes I have, I've also changed and tested with a fresh website/ and store view on the same install. Its as if anything I write in .htaccess regarding the domains is ignored/over ruled.
    – Jonny-C
    Dec 9, 2014 at 21:12
  • I have read of instructions to edit virtual host and http.conf but I cannot find this file and was told by web host I can't edit those on a shared hosting plan???
    – Jonny-C
    Dec 9, 2014 at 21:14

2 Answers 2


It seems so simple but I have found a solution (may not be the best).

Open index.php to edit and comment out line
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

Add the Switch command

switch($_SERVER['HTTP_HOST']) {
    case 'B.com.au':
    case 'www.B.com.au':
        $mageRunCode = 'B_Store_code';
        $mageRunType = 'store';
    case 'A.com':
    case 'www.A.com':
        $mageRunCode = 'default';
        $mageRunType = 'store';



So generally magento isnt recommended for shared hosting plans, as there are some configuration settings that are global to the server, that you cannot edit. You may not even be able to edit the mysql configuration files.

I would suggest possibly moving to a VPS like digital ocean (if you are confident in adding packages to install apache2 and etc...) or get someone to build the server to suit.

Sorry I cannot be more helpful, but I seen many people try magento on a shared hosting solution, and their experience is not what they expected.


  • Thanks, Thats helpful. Thats probably the end solution, but for now Ill keep plugging away for a stop gap.
    – Jonny-C
    Dec 9, 2014 at 21:30
  • No worries, I think the time you spend plugging away may end up costing you more than its worth. Have a look at their pricing, it probably costs you just as much for your Shared Server, without the roadblocks your hitting. Dec 9, 2014 at 21:56
  • Whilst DO is cheap, be sure to factor in the time and expense (and especially expertise) in being able to properly set up and configure the server. Jumping from "beginners level" development skills to s Magento ystems administrator is quite a leap. A beginner needs support, guidance and help; not to be dropped in at the very, very deep end. A VPS is totally inappropriate (for any store, let alone a beginner), the OP is far better off with a specialised shared host. Dec 9, 2014 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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