Multiple website with different domain setup

apricot

Free Member
  • Apr 7, 2012
    582
    76
    Hi,

    I am trying to setup a second domain magento. It is magento 1.7. I followed below posts and set up everything that needs to be done on the admin page (Create store, website etc)

    then i copy index.php and .htaccess from current domain and paste to new domain root.

    Until here everything is fine but i am totally confused with the update that i need to do on index.php. I was wondering if anyone knows what i need to do next?

    Here is the post that i followed.
    http://www.crucialwebhost.com/kb/how-to-setup-multiple-magento-
    stores/

    I appreciate if anyone can guide me on this.

    Thank you in advance,
     
    • Like
    Reactions: beauty900uk

    dx3webs

    Free Member
    Feb 22, 2011
    492
    131
    Lincoln, UK
    dx3webs.com
    Once you have done the magento side of things dont setup a new root

    Instead point your new domain to the same root folder as your original eg httpdocs / public_html

    then edit index.php and add

    if ($_SERVER['HTTP_HOST'] == "newdomain.com" || $_SERVER['HTTP_HOST'] == "www.newdomain.com"){
    $_SERVER["MAGE_RUN_CODE"] = "website_code_you_used_in_manage_stores";
    $_SERVER["MAGE_RUN_TYPE"] = "website";
    }

    just under umask(0);
     
    • Like
    Reactions: beauty900uk
    Upvote 0

    dx3webs

    Free Member
    Feb 22, 2011
    492
    131
    Lincoln, UK
    dx3webs.com
    Provided you do not need an ssl cert for each domain it is relatively straight forward to create a multi-store setup.

    1) configure magento.

    Create a new root category for your new Store.

    In system > manage stores

    Add a new website, store and store view for your new site. Remember the code for the website. Point the store to your new root category.

    2) Create a domain alias for you new domain pointing to your existing domain.

    3) Add a little logic to index.php


    Code:
    umask(0);
    
    if ($_SERVER['HTTP_HOST'] == "newdomain.com" || $_SERVER['HTTP_HOST'] == "www.newdomain.com"){
    $_SERVER["MAGE_RUN_CODE"] = "website_code";
    $_SERVER["MAGE_RUN_TYPE"] = "website";
    }
    
    /* 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';
    
    Mage::run($mageRunCode, $mageRunType);
     
    Upvote 0

    Latest Articles

    Join UK Business Forums for free business advice