We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I have successfully set up contexts with separate subdomains, but I am having some trouble setting up a new context in a subdirectory of my main installation. I have

    • Created the subdirectory /subdirectory/
    • copied .htaccess, config.core.php, and index.php into /subdirectory/
    • Modified index.php to initialize the 'mycontext' context
    • Created the 'mycontext' context
    • Added context settings for base_url, http_host, site_url, and site_start

    I can view the resource that I have designated as 'site_start', but I get an error when I try to view any other resource in this context.

    I have tried pretty much every combination on the following context settings and got the same results (or worse). Can someone verify which are right for this case?

    Anything else I might be missing?
      • 42562
      • 1,145 Posts
      In my .htaccess I have
      RewriteBase /subdirectory
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
      In my template
      <base href="http://mysite.com/subdirectory/" />

      In my context settings
      base_url      '/subdirectory/'
      site_url      'http://mysite.com/subdirectory/'
      //site url= how we access your site, the link


      I make sure I have the same spelling of the context in the index.php and that the config.core.php has the correct root path to the core folder.

      As discussed elsewhere, viewing the resources from within the manager might prove impossible, directly access the resource in the browser.

      Multi context except when it is for multi-domain, proves to be a dumb donkey show. Does not work!!! as expected.
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 3109 ☆ A M B ☆
        • 894 Posts
        Quote from: donshakespeare at May 09, 2013, 05:03 PM

        I make sure I have the same spelling of the context in the index.php and that the config.core.php has the correct root path to the core folder.

        As discussed elsewhere, viewing the resources from within the manager might prove impossible, directly access the resource in the browser.

        Multi context except when it is for multi-domain, proves to be a dumb donkey show. Does not work!!! as expected.

        To view resources from the manager you have to login via the context you want to preview the resources from ie: manager.domain1.com manager.subdomain.com only then you can preview the resources directly from the manager but it won't work for the other context.

        Also it is much easier to use ContextRouter the manual method will require you to do a lot of URL rewrites to get you sites working with some MODX extras and resources outside of your site/subdomains assets folder.

        ContextRouter is not only easier but handles all this stuff for you as well very easily.

        I see a lot of people doing the manual method for hosting multiple sites on a single MODX install and having all sorts of issues lately looks like I found what my next tutorial is going to be smiley
          Benjamin Marte
          Interactive Media Developer
          Follow Me on Twitter | Visit my site | Learn MODX
          • 14883 ☆ A M B ☆
          • 450 Posts
          Quote from: donshakespeare at May 09, 2013, 05:03 PM
          In my .htaccess I have
          RewriteBase /subdirectory
          RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
          In my template
          <base href="http://mysite.com/subdirectory/">

          In my context settings
          base_url      '/subdirectory/'
          site_url      'http://mysite.com/subdirectory/'
          //site url= how we access your site, the link


          I make sure I have the same spelling of the context in the index.php and that the config.core.php has the correct root path to the core folder.

          As discussed elsewhere, viewing the resources from within the manager might prove impossible, directly access the resource in the browser.

          Multi context except when it is for multi-domain, proves to be a dumb donkey show. Does not work!!! as expected.

          This got me where I needed to go. I think I must not have tried the .htaccess RewriteRule AND the context settings BOTH with the /subdomain in them at the same time. Maybe I just needed to walk away from it for a couple of days and come back with a clearer head.

          I'm not sure what either of you mean about "viewing the resources from within the manager". Can you clarify that? I don't seem to be having any problems with it.
            • 3109 ☆ A M B ☆
            • 894 Posts
            Quote from: jrotering at May 10, 2013, 12:29 PM

            I'm not sure what either of you mean about "viewing the resources from within the manager". Can you clarify that? I don't seem to be having any problems with it.

            He means when you click on view resource in the manager, if you login via the main sites manager you won't be able to preview the other contexts unless you specifically type the url otherwise it will give you a 404 error from the main site.
              Benjamin Marte
              Interactive Media Developer
              Follow Me on Twitter | Visit my site | Learn MODX
              • 42562
              • 1,145 Posts
              Yea, that's precisely what I mean.

              It's a bore though, to have to log-in first via the context in question.


              @jrotering all squared now?
                TinymceWrapper: Complete back/frontend content solution.
                Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                • 3109 ☆ A M B ☆
                • 894 Posts
                I just finished writing a review blog post about ContextRouter check it out and let me know what you think CMSTricks.

                Thanks for the inspiration guys, have a great weekend wink
                  Benjamin Marte
                  Interactive Media Developer
                  Follow Me on Twitter | Visit my site | Learn MODX