Migrating several standalone WP domains to WP Multisite

I decided to merge a number of existing standalone WP installs into one multisite installation, so that I would have less maintenance to keep things updated and free of security holes. Whilst there are a number of excellent guides out there, none of them quite got me there… I eventually sorted out what I needed to do. So here are some quick notes on my migration of several separate wordpress sites onto a multisite WP, on a hostgator linux hosting service with cpanel. I will fill in the bits that the usual instructions leave a little unclear. There are some caveats at the end.

Let’s say you are starting with domain example1.com and example2.com.

First set up a new WP-multisite installation and make some sites within this to serve the pages and posts.

  1. make a new add-on domain to hold your multisite setup using cpanel. If your base hosting domain is mysite.com, for example you could create an Addon domains – say  multi.mysite.com.
  2. install WP multisite into the directory for multi.mysite.com : using Quickinstall in cpanel install a new default wordpress install, into the directory for multi.mysite.com.
  3. follow the directions at https://codex.wordpress.org/Create_A_Network to make this default single site install into a multisite install (just a few minor edits). Choose the subdomains option at step 3.
  4. use the network admin menu to add new sites, one for each of the domains you are migrating. For example, make sites example1.multi.mysite.com and example2.multi.mysite.com (later you will link these to the domains example1.com and example2.com.)
  5. Log in as an administrator to example1.com and example2.com. Export the contents of each blog using Tools::Export in the dashboard.
  6. Import these export files into their respective multisite sites using the dashboard Tools::Import. If the system says there is no importer installed, click the wordpress installer title in the list of possible importers that is presented, and this should install the importer. This should import the posts and pages, and the images if you click the get the images checkbox.
  7. In the Network admin page, add the necessary plugins and themes that you are using in the migrating blogs, and network activate them.
  8. in each of the new sites sites (eg example1.multi.mysite.com and example2.multi.mysite.com) enter the dashboard and configure the desired theme, configure the site (Dashboard::Appearance::Customise etc) to set up the appearance as you desire it to be. You still have domains example1.com and example2.com to use for reference so you can have new and old open side by side to confirm all look the same. If you want to automate this transfer of configuration settings, and your theme does not have this functionality, then you can follow the instructions at https://digwp.com/2014/04/backup-restore-theme-options/ to set up a backup and restore for theme options that may save you some time (caveat: those instructions may not apply to all settings in all themes).

Once you are happy with the configuration and content, it is time to move the domain to point to the new site. To do this you need to set up mapping of the domain into your new install.

  1. Add the plugin WordPress MU Domain Mapping (https://wordpress.org/plugins/wordpress-mu-domain-mapping/). The instructions with this include information about configuring ANAMES and CNAMES and the like. Ignore… this is handled by domain management in cpanel.
  2. In the new multisite dashboard, choose My sites::Network Admin::Dashboard. On the left menu select Sites::all sites.
  3. Hover over each of the sites you made earlier. At the bottom left of the screen/browser window you should the corresponding URL for the site. The final characters will be “?id=2” or some other number. Note the correspondence between the ID number and each site.
  4. In the new multisite dashboard, choose My sites::Network Admin::Dashboard. On the left menu select Settings::Domains.
  5. You should see listed any domain mappings you have already, but at this stage there will be none. Add a new domain – enter the site ID you determined earlier, and add the domain you want this to be mapped to. Click the Primary check box. Click SAVE.
    eg if example1.multi.mysite.com had id=2 you would enter Site ID=2, Domain = example1.com, primary=checked.
  6. The page should now show the new site on the list of domains, and Dashboard::Sites should list the new domain in the Mapping column in the list of sites.

Now to get the domain to use the new site instead of the old site, using cpanel.

  1. first, just so you can see if you are viewing the new or old site, make a small difference – eg a minor change to the Site Identity text (select site: Dashboard::Customise::site identity) so you can see if you are on the old site or the new site.
  2. In cpanel choose Addon Domains (or subdomains if you are mapping a subdomain name not an addon domain). Locate the relevant domain names. The second column is labelled Document Root. Click the small edit icon after the document root. Change the document root to the folder where you made your new multisite install. Click CHANGE. The list should now show the updated information.
  3. It will take minutes to hours for the change here to propagate to the relevant name servers and take effect. After a while you can reload the new domain name (example1.com or example2.com) and see if the pages are loading from the new site. Once that happens you can archive the old site folder, backup the old site database, and delete the old installation files (eg in quickinstall, or by manually deleting the folder and the corresponding mysql database – take care you delete the correct one). It may be sensible, however to delay the deletion until you are 100% convinced the multisite setup is working as you want. If something critical fails, it is easy to revert to the old site by changing the domain to point the root back to the original folder.

NOTES: Caveat emptor

  1. If you are migrating old sites, note that some plugins that you have used in the old sites may no longer be supported / available.
  2. Some plugins that work well in single site set-ups do not work well in mutisite installations.
This entry was posted in IT, software, Uncategorized, WordPress. Bookmark the permalink.