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.

MSM Installation Configuration

July 01, 2007 4:55am

Subscribe [1]
  • #1 / Jul 01, 2007 4:55am

    GregF

    18 posts

    I’m considering purchasing MSM, but I have a concern about installation.

    MSM installation calls for a separate “starting” directory for each site.  Lets say you have, under your server root, a directory called mysite1 for http://mysite1.com, mysite2 for http://mysite2.com, and mysite3 for http://mysite3.com.  Bear with me….

    Lets say my hosting provider will not fully by support multiple domains (ie hostmysite.com) by providing routing for separate directories for each domain, but does allow you to point multiple domains to the same server.

    This is done by setting the DNS ‘A’ record for each of the domains to the same IP address.  Now we have, say mysite1.com, mysite2.com, and mysite3.com hitting the same directory, and thus the same index.php at the server root.  Under the server root are the ee system directory, template directory, etc, as well as the site directories: mysite1, mysite2, and mysite3.

    The http header contains a value for which domain is hitting the root index.php.  Wouldn’t it be possible code this root index.php this way (pseudocode):

    If domain is mysite1.com, then include mysite1/index.php,
    else if domain is mysite2.com, then include mysite2/index.php,
    else if domain is mysite3.com then include mysite3/index.php

    This should take care of the home page, then after that point, you would have to use mod rewrite or site config options to get URLs pointed to the right place.

    Is this totally squirrelly or is there a possibility here?

    Thanks.

  • #2 / Jul 01, 2007 12:47pm

    Robin Sowell

    13255 posts

    Heh- I’ve given the server gurus a heads up on this one, as I’ve never attempted such a setup.  Which doesn’t mean it’s squirrelly, but…  Let’s see if the server pros chime in with a more definitive answer.

  • #3 / Jul 02, 2007 10:11am

    Robin Sowell

    13255 posts

    Heh- Paul is sneaky.  Keep in mind, this isn’t tested, but his idea is:

    PHP has two predefined variables that typically contain the server URL, $_SERVER[’SERVER_NAME’] and $_SERVER[’HTTP_HOST’], and I have found the latter to typically be more reliable but mileage may vary.  With one of these variables, one should be able to code the path.php file to include the correct $site_name value for the domain being requested.

    $site_name = 'default_site';
    
    if ( isset($_SERVER['HTTP_HOST']))
    {
        if (stristr($_SERVER['HTTP_HOST'], 'expressionengine.com'))
        {    
            $site_name = 'expressionengine';
        }
        elseif (stristr($_SERVER['HTTP_HOST'], 'codeigniter.com'))
        {
            $site_name = 'codeigniter';
        }
    }

    Slick, no?  And no .htaccess involved.  Make sense what he’s doing there?  I’d run a couple of tests to make sure you can get the site name variable to ‘take’, but it looks doable.

  • #4 / Jul 03, 2007 9:59am

    GregF

    18 posts

    Thanks Robin, that’s what I had in mind.

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

ExpressionEngine News!

#eecms, #events, #releases