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

Answered New Context

    • 40088
    • 708 Posts
    Revo 2.5.0

    I have 2 contexts, the default "Website" and a new one, "Sandbox". Each context has a single Resource.

    The idea is "Website" will be for the Administrator user-group, while "Sandbox" is for the "Editor" user-group.

    The Problem
    When I preview the "Sandbox" Resource it's the "Website" Resource (the site homepage) that opens even though the url correctly shows the "Sandbox" Resource.

    What am I missing?

    This question has been answered by sottwell. See the first response.

      Todd
    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Do you have the "web" resource (#1) set as the error page? Sounds like you are getting the not-found error.

      What are you using for routing?

      I prefer to use XRouting, it's very simple to use. All you need to do is set up some context settings.
      https://modx.today/posts/2015/05/using-xrouting-for-multilingual-websites-in-modx
        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
        • 40088
        • 708 Posts
        Thanks Susan, got it. I was missing some Context Settings.

        XRouter is so wonderfully simple!
          Todd
          • 40088
          • 708 Posts
          Susan,

          If I'm running MODX in a sub-folder, how would this affect the Context Settings?

          The routing works fine locally, but that site is at root level. The remote site is in a sub-folder and it's throwing a 404.
            Todd
            • 30912
            • 463 Posts
            Id guess your base URL rewrite isnt looking at the subfolder, so its probably set to RewriteBase / not RewriteBase /moo/
              • 40088
              • 708 Posts
              The base URL is pointing to the correct directory.

              Even for the default Website context previewing a Resource throws a 404.

              I don't know if it's a sub-folder issue, or if I messed something up when I created the new Sandbox context.

              UPDATE
              As a test I created a new context on another remote site, one that's not installed in a sub-folder and it works perfectly.

              Whatever the problem it would definitely seem to be related to the installation being in a sub-folder. Apart from all the Resources (both contexts) throwing a 404 the rest of the Manager functions normally. [ed. note: todd.b last edited this post 10 years, 5 months ago.]
                Todd
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                What about the RewriteBase directive in your .htaccess file?
                  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
                  • 40088
                  • 708 Posts
                  That one is
                  /sub-folder
                    Todd
                    • 3749
                    • 24,544 Posts
                    First, make sure the base href tag in all your templates is called uncached (with the exclamation point):

                    <base href="[[++site_url]]" />


                    If that doesn't solve it, try using just a slash in your Rewrite Base line. The subdirectory name isn't usually necessary there.
                      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