-
MODX Staff
- 10,725 Posts
The relative URLs really are necessary to keep your site definition portable. Instead of defining all your paths as absolute in your content, including js script includes, I recommend using the base href tag in your templates (in the HEAD element, before the appearance of any elements with src or href attributes) to properly keep all paths referring to the correct location. In reality, since modx is executing from a single url (/index.php), the path is always relative to that location, regardless of where it sits in relation to your web servers document root.
-
MODX Staff
- 10,725 Posts
Consider moving a site to or from a subdirectory; with absolute paths the entire site would break in a subdirectory, as it would be looking for the modx dependencies in the document root, not the actual root location of MODx which is the location that PHP would be using as the location of the currently running script.
Though this may not be important to everyone, it’s something I’ve run into countless times, for instance, when testing a new release sometimes I like to try it out as a subdirectory of the real site, or a subdomain, and if all my paths were hardcoded, it would be a real pain in the rear.
-
☆ A M B ☆
- 24,524 Posts
Indeed, and if for some reason your host becomes unsatisfactory and you want to move your site it makes things a lot easier.
Thanks for the tips, but honestly, I don’t think moving the MODx installation up/down a few subdirectories is very likely. Even if you were to change hosts, you wouldn’t need to change the directory structure it was in.