Show Moved MODX Core in File Tree

Using a Media Source to show files in a moved and/or renamed core directory in the Manager's File tree

If you have followed the advice to harden your site by renaming and moving the core directory above the web root, you may have noticed that the files in that directory no longer show up in the File tree in the Manager. You may have fixed this yourself, but if not, we'll look at how to do it in this article.

MODX logo


The secret to making the files show up is the creation of a new Media Source to show them. By default, there is already a Filesystem Media Source that is installed automatically when you run Setup. It shows the files in and below the MODX root directory. Once you move the core above that, its files no longer show up. We need to create a new Media Source for those files.

There's no need to do this for the /manager, /connectors, or /assets directories because they must be in the web root to remain reachable by URL. Even if you rename them (and that's an excellent idea, especially for the /manager directory), they will still show up in the tree.

Renaming Ideas

For maximum security, the core directory should be moved and renamed. I'd suggest putting it above the web root. The directory it's in and the name should hide it's function. In our example, we'll put it in the directory above public_html called landscaping and we'll rename the core directory to shrubs. The goal is to pick names for the directories that no one would look in for critical MODX files.


Important: If you have not moved or renamed your /core directory, don't try to do it based on the information in this article. Moving the core requires changing four of the MODX configuration files. It's not difficult, but it's beyond the scope of this article. See the "Changing Default Paths" section of this page for detailed instructions. That page also has some other good advice about hardening your site.

New Media Source

Once you've moved and renamed the core, make a note of its path. You can figure it out if you look in cPanel's File Manager, but the most reliable method is to look in the MODX_CORE_PATH value of the config.core.php file in the MODX root directory. If the site is working, that's definitely the correct value. Cut and paste the value between the quotes (don't copy the quotes). Be careful not to modify anything in that file.

Here's an example using our landscaping directory with the core directory named shrubs.

Go to "Media -> Media Sources" on the MODX Manager's Top Menu. The location will vary if you have an older version of MODX. In fact, if you have a very old version of MODX, there may be no Media Sources, in which case, you're won't be able to show the core files in the File tree.

Click on the "Create New Media Source" button. In the "Name" field, put Core Files. Add a description if you want to (it's optional), and set the "Source Type" to File System. Click on the "Save" button.

You should see your new Media Source in the grid. Right-click on it and select "Update Media Source." Next, you'll see a grid containing the Media Source's Properties. You can enter or edit a value for each property either by double-clicking on the property, or by right-clicking on it and selecting "Update Property." For Yes/No properties, double-clicking is more reliable.

Set the "basePathRelative" property to No, then enter the path you copied earlier in the value field of the "basePath" property. The other properties can be left at their default values. Make sure the path ends with a slash. It should almost always begin with a slash as well. Here's our example again:


Don't forget to click on the "Save" button at the upper right.

Your core files (and only your core files) should now show up in the File tree in a separate section called "Core Files".

Coming Up

In the next article, we'll see a way to make the search function in the MODX manager search by ID.

Looking for high-quality, MODX-friendly hosting? As of May 2016, Bob's Guides is hosted at A2 hosting. (More information in the box below.)

Comments (0)

Please login to comment.