We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25969
    • 118 Posts
    I’ve come up against a wee problem with how [~XXX~] doesn’t quite return the right path. Subsite is in the mix so it’s not a MODx bug or anything, but if I could get pointed in the right direction, though I could knock something up to fix this up.

    The problem is when using the regular domain, [~XXX~] works fine, but when using a "subsite" domain, it adds the base document twice. So for the path "home/subpage/" it will come out as "home/home/subpage/". Just a pointer to where I can hack up [~XX~] will be help enough though.
      • 33372
      • 1,611 Posts
      My best advice would be: Don’t. There’s no need to go hacking the core code in MODx. You’re much better off just hard-coding your base root in your config file or writing a plugin to write these URLs correctly (or rewrite them when they’re wrong).

      So the first thing I would do is try to fix your subsite setup so that it generates the URLs properly. If that’s not working out easily for whatever reason, then I’d just verify that the problem is that your base URL isn’t being set properly in every context and if so hard-code it in your config.inc.php file and see if that fixes it. And I guess the last kludge I’d attempt is just using a plugin to replace any occurrence of "home/home/" with "home/" when the document is rendered (look at the plugin that removes the MODX_MEDIA_PATH code for an example of how to do that).

      There’s pretty much never a reason to mess with the core code in MODx, and I suspect that you’d regret it if you did.
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options