ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Incorrect View Site URL when using Multiple Site Manager

August 14, 2012 10:21am

Subscribe [1]
  • #1 / Aug 14, 2012 10:21am

    Simon Jones

    3 posts

    hi there,

    I’ve set up my first EE multiple site installation which works fine in respect of the front-end websites. However, I have an issue with the “View Site” link in the top-right drop down in the EE admin system.

    At present I’m able to administrate the CMS via domain1.com/cms/ and domain2.com/cms/

    By default EE allows me to manage both sites via both URLs. The View site link, however, always goes back to the default website. I think this may also cause issues with links which EE prepends the site_url to.

    From what I can see the issue is caused by:

    * We are setting certain config settings via the config.php depending on the server hostname. This includes $config[‘site_url’]
    This is done to allow us to have a local, staging and live environment without having to make amendments to the database.

    * Because of the above when managing Site 2 via the Site 1 CMS admin URL the View site link is incorrect. Therefore, is it possible to lock the editing of Site 2 to only via the Site 2 URL?

    * Or is it possible for us to know what site is being edited in the config.php file so we can set the correct site_url?

    Any ideas appreciated.

    best wishes,
    Simon

  • #2 / Aug 16, 2012 9:57am

    Dan Decker

    7338 posts

    Hi Simon,

    Thanks for posting to the Forums!

    A master config and MSM can play nice together, you just have to get the bits in the right order 😉

    As a rule, don’t set any site specific values in config.php. Take this example:

    //CONFIG//
    $config['cp_url'] = "http://engine.dev/admin.php";
    $config['doc_url'] = "http://ellislab.com/expressionengine/user-guide/";
    $config['is_system_on'] = "y";
    $config['allow_extensions'] = "y";
    $config['site_label'] = "Test 23";
    $config['cookie_prefix'] = "";
    $config['multiple_sites_enabled'] = "y";
    
    index.php and admin.php site 1
    NO CHANGES
    
    index.php and admin.php site 2
    $system_path = '../system';
    /*---------------------------*/
    $assign_to_config['site_name']  = 'msm_test';
    $assign_to_config['cp_url'] = 'http://msm.dev/admin.php';
    $assign_to_config['site_url'] = 'http://msm.dev';
    
    --- admin ---
    $system_path = '../system';
    /*---------------------------*/
    $assign_to_config['site_name']  = 'msm_test';
    $assign_to_config['cp_url'] = 'http://msm.dev/admin.php';

    With that, and say the Focus Lab Master Config, you would use the $base_url variable for site 2:

    index.php and admin.php site 2
    $system_path = '../system';
    /*---------------------------*/
    $assign_to_config['site_name']  = 'msm_test';
    $assign_to_config['cp_url'] = $base_url.'/admin.php';
    $assign_to_config['site_url'] = '$base_url;
    
    --- admin ---
    $system_path = '../system';
    /*---------------------------*/
    $assign_to_config['site_name']  = 'msm_test';
    $assign_to_config['cp_url'] = $base_url.'/admin.php';

    That still lets the hostname trick work, keeps everything version controlled and should work out the kinks in your URLs

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases