misamisa misamisa - 11 months ago 57
MySQL Question

Move modx site from subfolder to root folder

I have an MODX site running on the shared server in the root folder (i.e. public/www/).

I also have an MODX testing site running in the subfolder (public/www/modxtest).

I want to move this testing site into the root in a way that the modx site in root folder is not affectetd until the end of migration.

I haven't touched MODX before and do not know the migration procedure.

One way of doing that may be using htaccess file and redirect the request to the root MODX site to the subfolder MODX site as in https://my.bluehost.com/cgi/help/347

This method might get confusing for other person as they wouldn't know this redirection happening and might happen to delete the subdirectory as prefixed 'test'.

What could be the better and reliable way for complete migration from subfolder to the root folder?

Thanks in advance

Answer Source

You don't specify which version of Modx you are using, but I assume it is Revo.

Moving a Revo-site can be difficult, but I've done it several times, so I've made a simple list over things that I have to do.

  1. Move all the files to the right directory.
  2. Open config.core.php in the modx-root. Enter your new path here
  3. Open core/config/config.inc.php and change all the paths and relative urls to match your new folder/url.
  4. Upload the setup-folder to your modx-root. If you don't have this folder, download it from modx.com: NOTE: Remember to upload the setup-folder for YOUR version of Modx as these may include changes. Uploading wrong setup may cause your Modx to crash. You can check your current Modx-version in your Manager-panel. Do this before moving all your files.
  5. Run the setup (select existing site).
  6. All done.

To find your full path, this PHP-script should do the magic:

echo dirname(__FILE__);

Place this in the Modx-root. This will be your root-path.

This should be a pretty bulletproof way to do it, but remember to take backup of all your files and be careful when changing paths and urls.