How Do I Migrate/Copy a MODx Site for Use as a New Site?

Hoping to obtain tips for migrating a MODx site for me to use as a new website so that I don’t have to start completely from scratch. I updated MODX version of the old site, installed the new MODx site for my new project, imported various assets, and also the contents of core/components, and core/ packages. I am now stuck on the “inject” database portion. I selected my new database at the new site location, and clicked import, but received errors. Does anyone have tips for what I might be doing incorrectly.

What I usually do is zip the original site then export the database to a .sql file or .txt file.

I then upload the .zip file to the new (other) server and extract the files. Then create a new empty database and copy / paste from the .txt file.

Edit the config.core.php files (in root, connectors, manager) to update the paths to the new install. Then in the core/config/config.inc.php file, edit the paths and then change the database credentials to match the new database.

Rewriting response after making a discovery. First, I do truly appreciate your feedback, and may actually move to the method you suggested. When you say copy and paste from the txt file… do you mean copy and paste into each of the 99 or so tables that display in phpMyAdmin via the cPanel?

On another note… I went to backup the database from the new install just in case… and discovered that… when I had performed the export of the old site’s database… I exported the wrong file. Now I have the actual file which has the database name instead of ‘localhost’ in the file name. I will try importing that one.

:slight_smile:

I paste (into sql box) into an empty database - there are no tables there as it’s a new database.

If you have PHPMyAdmin in your hosting control panel, you can export the database from a MODX site with the right MODX version and minimal content, then import it into the new database for the new website before you start adding the content.

Struggling with this a bit due to inexperience. Is there more of a step by step tutorial or method for packaging the site, and then loading it to a new account. I’m reviewing Moving Your Site - Maintenance | MODX Documentation but even that at points gets a bit tricky.

I don’t know of an easier step by step method. This thing you’re doing is one of the reasons we created MODX Cloud in the first place. You can take a snapshot of an existing site and inject it into a new MODX Cloud instance and go from there to customize and tailor the site.

That said, there are a couple methods we use to import MODX sites into MODX Cloud that could be helpful analogs for what you’re trying to do:

  • Rsync Migration which requires SSH access to the remote location but works well.
  • Manual Migration. Can be done using SFTP and the web with phpMyAdmin or a remote DB management tool.
  • There’s also Teleport which enables you to create Snapshots locally or on a server if you can run it, bundle sites and deploy them to your remote machine.

It might be worth while letting folks know what specific steps you’re having issues with and getting stuck on and we can help you get over the hurdles.

Again, this is a core feature of MODX Cloud—to take point-in-time captures (Snapshots) of sites and use them for new projects. They literally take minutes for small sites.

1 Like

Hi @smashingred “This thing you’re doing is one of the reasons we created MODX Cloud in the first place. You can take a snapshot of an existing site and inject it into a new MODX Cloud instance and go from there to customize and tailor the site.” Wow - that’s a nice feature!

1 Like