We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23072
    • 150 Posts
    Here’s one for the technical types out there wink

    Say I have a modx installation at basedomain.com.  basedomain.com has a section called basedomain.com/section1, and pages under that as well eg. basedomain.com/section1/page1 etc.

    Is it possible (and I realise it might need some code tweaks) to point another domain to this one, (so newdomain.com initially resolves to basedomain.com before any redirects are set up) but have it load up basedomain.com/section1 ?

    So really what I’m asking is if it is technically possible to have the new domain resolve to a modx subfolder set of pages and still keep the new domain in the address bar eg. newdomain.com == basedomain.com/section1

    I’m hoping this might be possible with some .htaccess rewrites as MODx doesn’t really care what URL you load it up with it seems - which is good in this case laugh

    Any ideas? Hope I’m making some sense!

    Just as an aside, the reason I’m hoping this is possible is that I have a case for having a site split into different sections but also into different domains if they get quite large. If the above could work then that would mean a little custom code to make sure the right domain loads (but that’s the easy bit and I can do that), but the benefits are that a) you have one manager to manage the sites and b) search engines don’t mind as long as the content from basedomain.com/section1 is only available at newdomain.com (so no duplication of content).
      Notanotherdotcom Ltd

      Web | Print | Marketing
      • 16085
      • 203 Posts
      To keep it simply I think you could use a htaccess in each of the domains roots and simply point them to each corresponding parts of your MODx set up.

      Or use the Subsites the MAD [HACK] - haven’t used it myself but the description sounds close to what you want, multiple domains one MODx db.

      ..can’t remeber if this was something 0.9.7 was going to include, I’m sure I seen a post or flyspray ticket about this.
        • 23072
        • 150 Posts
        Quote from: knightknight at Sep 22, 2008, 05:19 AM

        To keep it simply I think you could use a htaccess in each of the domains roots and simply point them to each corresponding parts of your MODx set up.

        I thought about that, but I’d really like the domain to follow through with the pages as well, which is the tricky bit. With a different template for each section it’s easy enough to set the BASE HREF to use the correct domain, but then you end up with newdomain.com/newdomain/page1 etc when using the navigation instead of newdomain.com/page1

        Quote from: knightknight at Sep 22, 2008, 05:19 AM
        Or use the Subsites the MAD [HACK] - haven’t used it myself but the description sounds close to what you want, multiple domains one MODx db.

        This is another interesting way of approaching it, but you then lose the ability to do other neat things like incorporate a wayfinder menu for a subsite into the parent site easily.

        Quote from: knightknight at Sep 22, 2008, 05:19 AM
        ..can’t remeber if this was something 0.9.7 was going to include, I’m sure I seen a post or flyspray ticket about this.

        I had a search but couldn’t find anything. If someone can find it or has any other ideas about this please let me know. Thanks for the suggestions knightknight smiley
          Notanotherdotcom Ltd

          Web | Print | Marketing
          • 25483
          • 741 Posts
          you could use htacces to just redirect to the right page, but your domain will change to the default domain or you will see newdomain.com/newdomain/page1.html like you said.

          I don’t think it is possible to give a folder in your modx installation his own domain. I would like to be able to do that too smiley


          MODx Revolution (0.9.7 == 2.0 == Revolution) will support more contexts, a context could be a subdomain or a separate domain. By changing the index.php you could change the context you want to show on that domain.
            with regards,

            Ronald Lokers
            'Front-end developer' @ h2o Media

            • 23072
            • 150 Posts
            Hmm, sounds interesting. Could you explain contexts a bit more please or point me in the right direction to read about them?
              Notanotherdotcom Ltd

              Web | Print | Marketing
              • 16183
              • 1,390 Posts
              Quote from: Pete at Sep 22, 2008, 06:36 AM

              Hmm, sounds interesting. Could you explain contexts a bit more please or point me in the right direction to read about them?

              For revolution stuff, including contexts, read Jason’s blog entry here: http://modxcms.com/transforming-modx-oo-mvc-orm.html
                • 23072
                • 150 Posts
                Ah, well it sounds like Contexts are exactly what I need from that post (no wonder I couldn’t find it - I wasn’t looking that far back laugh).

                I’ll sit tight for the Revolution then.

                Thanks all.
                  Notanotherdotcom Ltd

                  Web | Print | Marketing
                  • 16085
                  • 203 Posts
                  @Pete, my thoughts exactly. Wanted to do something similar to yourself, but I’d read this was in the road map.
                    • 22303 MODX Staff
                    • 10,725 Posts
                    There will actually be two different approaches for multi/sub-domain support in Revolution:
                    [#] Physical index.php in separate virtual host configuration for each domain that instantiates the proper Context directly (i.e. copy index.php and .htaccess for the web context to another directory and change the $modx->initialize(’web’); to initialize a specific context by name).
                    [#] Virtual Context switching where multiple virtual hosts all point to the same index.php (less efficient since you must load the main context and then switch via plugin based on the HTTP_HOST being requested).
                    Both features are at least partially working in the current Revolution branch (not alpha-3), but we will be introducing installation support for deploying multiple physical contexts at some point in the near future to make it easy to setup and configure.
                      • 23072
                      • 150 Posts
                      Cheers for the info Jason - looking forward to that.

                      Can you tell me how resources such as files and images would be stored in the first example? Would they all be stored in the root installation domain and simply have their URL’s cloaked somehow to look like they’re coming from the other domain, or would each domain in this case have it’s own set of folders for resources?
                        Notanotherdotcom Ltd

                        Web | Print | Marketing