We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3677
    • 130 Posts
    I’m testing out two domains hosted on a single Cpanel account.

    Both domains are resolving to the home page and I am using the context switcher Plug-In approach to do this.
    Looks something like this:
    <?php
    switch ($modx->getOption('http_host')) {
    
        case 'www.domain2.com':
            $modx->switchContext('www.domain2.com');
            break;
        default:
            $modx->switchContext('web'); 
            break;
    }


    On each context I have settings that define site_url, base_url, site_name, site_start, and http_host.

    Now for the problem...every time I clear the site cache and then try to access the 2nd domain I get a 404 error.
    This persists until inside the manager I click on any resource that is assigned to the 2nd domain context. As soon as I do that, the site starts resolving again.
    I first saw this in my dev environment and wanted to get it to a production site to test. It also happens in the production environment.

    Very odd...any ideas what could be happening here?

    Thanks,
    -Brian
      • 3677
      • 130 Posts
      Ok...more details.

      I’ve been looking at the caching folder and I noticed that when you clear the site cache, there is a context specific folder that gets deleted (matches the context name).
      As soon as that folder is gone, I get a 404. When I click on a resource inside of the context, it recreates the cache folder for that context and everything starts working.

      If I change the System Setting "Enable Context Setting Cache" to "No", then the context cache folder gets deleted for good and the site never resolves.

      -Brian
        • 3677
        • 130 Posts
        Doesn’t ring a bell with anyone else? I could just be missing something but this seems like a bug. I am thinking that the context specific cache folder should probably not be entirely deleted when the site cache is cleared.
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Does the web context folder remain?

          If so it sounds like a bug to me too!


          I know there’s been some (well, "some") changes to the caching mechanism which is going to be released in 2.1 (I guess.. it’s committed to github anyway), so it’s very possible that this issue has been resolved with the upcoming changes as well.

          I’d probably file a bug for it anyway - if it’s fixed it’s fixed, and if it isn’t it wont get lost in the forums.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 3749
            • 24,544 Posts
            Yes, definitely file it. smiley
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 32525
              • 27 Posts
              Quote from: Mark at Feb 18, 2011, 07:58 PM

              Does the web context folder remain?

              If so it sounds like a bug to me too!


              I know there’s been some (well, "some") changes to the caching mechanism which is going to be released in 2.1 (I guess.. it’s committed to github anyway), so it’s very possible that this issue has been resolved with the upcoming changes as well.

              I’d probably file a bug for it anyway - if it’s fixed it’s fixed, and if it isn’t it wont get lost in the forums.

              I am getting the same problem too - just to confirm!
                • 3749
                • 24,544 Posts
                Did someone file this as a bug?
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Sure sounds like you do not have your context setup with permission for anonymous users to load it. huh
                    • 3749
                    • 24,544 Posts
                    Quote from: OpenGeek at Mar 10, 2011, 12:43 PM

                    Sure sounds like you do not have your context setup with permission for anonymous users to load it. huh

                    Has that "Load Only" policy for the (anonymous) user group always been there in the default install? tongue

                    Those of you with the problem:

                    Try adding a Context Access ACL entry for the (anonymous) user group for each context other than mgr and web (like the one already there for the web context). Make the minimum role "member- 9999" and the policy "Load Only."
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting