We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13993
    • 100 Posts
    I want to start studying how ModX rewrites it’s urls. I am not in love with it’s current multiple versions so I want to research how I could go about writting a plugin to enforce strict url policies. Or worst case, write a hack.

    If you could point me to which files control the url function and maybe even a brief overview of the logic behind the rewriting, it would be greatly apreciated. I looked through the docs but did not find what looked to me at least to be any appropriate api calls to affect such rewrites.

    Thanks
    Jeremy
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      It’s in the manager/includes/document.parser.class.inc.php file. Look for the "function makeUrl($id, $alias=’’, $args=’’, $https=-1)" function. Line 1428 in my 0.9.2.1 installation, so it should be somewhere around there.
        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
        • 22303 MODX Staff
        • 10,725 Posts
        Warning, but that’s only part of it. Unfortunately, rewriting is tied closely into just about all of the core code. It would require a completely hacked version to support this currently, and I know of no way to get around this. But doing so would definitely prevent you from following any MODx upgrade paths easily. All I can offer is the fact that a near future release will address this by providing all of this functionality in a centralized external class file that can be easily overridden by the core, and you can have it rewrite URL’s in just about any way you want to.

        You might be better off looking at solutions using mod_rewrite to enforce the "strict URL policy" you mention for now. I believe there are some other suggestions in these forums for addressing this. And many of the "looser" URL policies of 0.9.2 have been fixed for 0.9.5 which is approaching the final release stages.
          • 13993
          • 100 Posts
          I think I found a way to get around a lot of the issues and I’m working on the rest.
          http://modxcms.com/forums/index.php/topic,7346.0.html
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: JeremyL at Sep 22, 2006, 12:51 AM

            I think I found a way to get around a lot of the iddues and I’m working on the rest.
            http://modxcms.com/forums/index.php/topic,7346.0.html
            Great contributions JeremyL. I’ll keep an eye on your progress and will work on incorporating this into the core properly.