We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21792
    • 37 Posts
    HI,

    I have a client site that I have built in MODx 2.0.4

    This Works fine.

    Then the client asked for two mini sites. I set these up as new Contexts, set the context settings and set the domain aliases up in my hosting config.

    These two mini sites work fine.

    Then the client asked for two more mini sites. So I repeated the above process and now I get

    Page not found
    The page you requested was not found.

    To make contexts work, I have altered the index.php file so the bi that initializes the process looks like this


    if(strpos($_SERVER['SERVER_NAME'],'roseandco')> -1) {
            $modx->initialize('web');
    } else {
    
            //die($_SERVER['SERVER_NAME']);
    
            $modx->initialize(str_replace('www.','',$_SERVER['SERVER_NAME']));
    }


    If I uncomment the die() statement I get the domain name, which is in the context settings as http_host so I know that MODx is getting the request; also that message is not my default apache error page!

    I’ve lost count of how many times I’ve cleared the cache

    The main site (web context) and two previous mini sites are still both working as intended.

    Has anyone got any ideas on how I can get this working or what I should look at next?
      • 21792
      • 37 Posts
      In my previous past i said,

      "I’ve lost count of how many times I’ve cleared the cache"

      Looking at this again today I notice that when I try to clear the cache in the manager, the window opens but just ’hangs’

      Nothing is logged in the error log

      A few lines are added to the access log, but it’s difficult to see which is last of the requests from the clear cache command
        • 21792
        • 37 Posts
        Solved:

        I was using a test sub domain and trying to use that sub domain as the name of the context.

        Although the context settings were set up to use the dub domain, the context key was being passed to $modx->initialize() incorrectly.

        I’ve had to put some extra if() statements my above code to cope with the test domains