2.14.4.7. Move core directory outside MODX root directory

For greater security in MODX, you can move the core directory outside the site root directory. To do this, you need to perform the following steps:

  1. Use the file manager or any FTP client and move the core directory from the site root directory to the level above — to the directory with the name of the main domain (so that it is available at the path example.com/core/, where example.com is the name of the primary domain).
  2. Edit three files: config.core.php, manager/config.core.php and connectors/config.core.php. In each of them, find the line:
    define('MODX_CORE_PATH', '/home/user/example.com/www/core/');

    And replace it with the following:

    define('MODX_CORE_PATH', '/home/user/example.com/core/');

    Instead of user, specify the hosting account name, and instead of example.com specify the name of the primary domain without subdomains.

  3. In the moved core directory, edit the config/config.inc.php file and replace all occurrences of /www/core/ with /core/.
  4. Check the website's functionality. If errors occur in the functions and classes, double-check all paths to the core directory in the above-mentioned files.
コンテンツ