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
-
☆ 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.
-
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.