We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30491
    • 44 Posts
    Hi

    anyone ever manage to set the site_start (in system settings) to a resource id that is in a different context (as in other than the default 'web' context)? I've tried everything and to no avail. Setting my site_start value simply results in modx sending me to the modx error page (default is set to resource id #1).

    Theoretically it should work, but it doesn't and I'm not sure whether to consider it a bug or am I simply misunderstanding the way contexts work.

    The scenario:

    Context A (web)
    Context B (Russian site)

    I want it such that when visting the main domain www.maindomain.com, it will go to the resource id specified in the System Settings in the site_start key. Suppose it has an ID of 54, that page is under Context B. When setting the site_start to 54, it results in an error (one which I can't get more info about because modx simply sends me to specified error page).

    If anyone can help with any solutions or insight into this, I'd really appreciate it

    Thanks

      • 3749
      • 24,544 Posts
      First, it should be a Context Setting for each front-end context, not a System Setting.

      If you've done that and are still sent to the error page, it's likely that either the Context or the Resource is protected by an ACL entry and/or you're missing an ACL entry that allows access to the Context of the Resource.
        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        The first thing I learned about contexts is that you have to give the "anonymous" group load, list and view for the new context. If they don't have that, then they can't even discover that the context's resources exist. It was something of a problem for me to understand; in Evo permissions are "everything is public until made private". Revo is just the opposite; everything is private and every user, including the anonymous users, must be given permissions to interact with anything.

        I'm sure I still don't quite have it right, but I did manage to bumble through one multi-context setup. More practice should improve understanding in time.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 30491
          • 44 Posts
          Hi guys,
          I had suspected it was an ACL issue and after adding some ACL's it still didn't help.

          BobRay: I did have Context Setting for the site_start in the new context. It has the same value as the System Settings->site_start.

          sottwell: Thanks for the tip, I did try that. However it didn't appear to help actually.

          These are the values for the new contexts ACL:



          Am I misunderstanding something?

          Thanks for the help
            • 3749
            • 24,544 Posts
            @susan: I think what you're seeing is true in practice, but not in theory. In theory, everything is unprotected by default in Revo too. The fact is that if you never put your new context in any Context Access ACL entry, all its resources will be visible to everyone on the front end. Unfortunately, its resources will be hidden from users in the back end (though I've never understood why this is necessary). As soon as you create the Context Access ACL entry for that context to allow a Manager user to see the resources, the context is protected in the front end -- hence the need for the Load, List, and View ACL entry.

            @tourshi: Your ACL entries should allow not-logged-in users to see resources in that context in the front end (unless you have Resource Group ACL entries that would protect them). You shouldn't have the duplicate entry shown above, however -- you should just need one. I believe they might hide the resources in that context from logged-in user, though, depending on how you've set things up.

            Have you tried viewing from another browser where you're not logged in to the Manager. Previewing from the Manager leaves you in a weird state, login wise, and can confuse the issue.
              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
              • 30491
              • 44 Posts
              Hi Bobray

              I deleted the duplicate ACL entries, and there aren't any Resource Group ACL entries protecting them. I've also tried it from different browser that isn't logged in (same result).

              I'm pulling my hair out :p

              It should be pretty straight forward, change the site_start and it should redirect to that page--I don't see what is really causing the issue and that's another point, is there anyway for MODX to tell me what the error is exactly? (instead of merely redirecting to default error page. )

                • 3749
                • 24,544 Posts
                You could check the error log.

                Have you also created Context settings for the other site-related values (cribbed from http://www.belafontecode.com/modx-revolution-hosting-multiple-domains/) :

                site_start – the ID of your new context’s homepage.
                base_url – Set this value to “/” (no quotes) since we’re making the root of the URL our base.
                http_host – Set this value to “yourseconddomain.com” (your add-on domain url)
                site_url – Set this value to “http://www.yourseconddomain.com/” (FULL domain url). Must have trailing slash.

                It might also help if you posted the code you use to redirect to second context.
                  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
                  • 30491
                  • 44 Posts
                  Hi Bob,

                  Really appreciate they help. Yes, I have added context related settings and no I am not using any script to redirect to second context, merely a single link to switch from one context to the other.

                  Oh and error log is blank.

                  Confusing...

                    • 3749
                    • 24,544 Posts
                    Is the user clicking on a link in one context to switch to the other? If so, I think you have either call $modx->switchContext('contextName') at some point or use a full link to the second page.

                    How are you directing the user in the first place? Are you using a plugin or index.php with a virtual host?
                      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
                      • 30491
                      • 44 Posts
                      Hey Bob

                      Currently, the user accesses the other context via a full link. For instance: http://www.domain.com is under context web, on that main page there is a link at the top that when clicked redirects to different context once clicked it goes to http://www.domain.com/russian/ which has it's own context and all context related settings like site_start etc...

                      The issue I am experiencing is, I am trying to get www.domain.com to mirror the Russian context that I have. I am trying to do this by setting the site_start with the Russian main-page on the Russian context. For some reason modx is not complying.