Migrating a Site out of Multisite Manually

The site you’re moving out of Multisite will have three components that you need to copy from the Multisite network:

  • theme and plugin files—you might copy these across or reinstall them in the new site
  • uploads—you’ll find these in the site’s subdirectory inwp‑content/uploads/sites
  • database tables—you don’t need all of the database tables but just the ones relating to this site

Note: If your Multisite network was created prior to WordPress 3.5, you won’t have asites folder. Instead you’ll have a blogs.dir folder in wp-content with all of the upload files for the subsites. This will have a numbered folder for the site you’re migrating, which you copy instead. I’ll cover this in more detail below.

Before you start, think about the reasons you’re migrating the site. Could it be purely to have a new domain name? If this is the case, then the free domain mapping plugin will let you give individual sites their own domain, and visitors will never see the domain of your Multisite network.

But if this isn’t the only reason, then read on!

Before you do anything like this, it’s a good idea to back up your Multisite installation. Use your preferred backup plugin, or a combination of FTP and phpMyAdmin if you prefer to work manually.

You’ll use this backup to copy the relevant files to your new site, and it also gives you some peace of mind in case you have any problems.

Each site in a Multisite network has its own unique numerical ID. This is used to identify its folder in the wp-content/uploads/sites directory (or wp-content/blogs.dir if your Multisite network is older—see above), and also to identify the database tables for that site.

Find this by going to Network Admin > Sites and then selecting the Edit option for the site you’re working with. The URL WordPress takes you to will give you the site’s ID. The URL should be in the form http://mynetwork.com/wp-admin/network/site-info.php?id=XX.

XX is the ID of your site, and will be the name of the folder containing its files, as well as the prefix for its database table names.

As you’re only moving one child site and not the whole installation, you won’t need the contents of your entire database.

In PhpMyAdmin, click on the Export tab. Then find the tables relating to the site you’re exporting. They will begin with wp_XX_, where XX is the ID of your site. An example is shown below.

moving-a-site-out-of-wordpress-multisite-phpmyadmin-siteID-tables

Select all of the tables relating to your child site and then export them.

Note: WordPress Multisite stores all data relating to users of the network in thewp_users and wp_usermetatables: it doesn’t create separate ones for each site. If you have a lot of users on your site which you want to copy across from the network, then you might want to export those tables as well, import them to the new site and edit users in the admin screens to remove any that are not relevant to the new site. However, if your site just has one or two users, it’s easier to recreate them on the new site. For more information on Multisite and database tables, see this tutorial on theWordPress database and Multisite.

Make a copy of the sql file that’s been downloaded to your machine and give it a name that tells you what it is (for example by adding copy to its name). Open it in a code editor.

Change all instances of the site’s domain in the Multisite network to its new single site domain. For example if your site was at http://network.com/mysite, change it to to http://mysite.com. If your network uses subdomains, you’ll need to change all instances of http://mysite.network.com. If you do this I’d advise also running a check for the subdirectory version just in case. Save your file.

Note: If your site had a domain mapped to it which isn’t the domain you’re moving it to, you’ll need to replace that with the new domain too. Tread very carefully here, and keep backups!

The database tables in your new single site installation won’t have prefixes for the site ID, so you’ll need to remove these. In your sql file, replace all instances of wp_XX_with wp_, where XX is your site ID.

Now save the sql file.

In phpMyAdmin, create a new database in the location for your new site and install WordPress in the normal way.

Identify the plugins used by the child site and either install them in your new WordPress site via the Pluginsscreen or upload them from the backup you took of your old site.

Do the same for any themes your site is using—copy them from your backup to thewp-content/themesdirectory of your new standalone WordPress installation, or just reinstall them.

Copy the uploads from your old site to the new one:

  • If the network was created after WordPress 3.5, it will have a sites folder in wp-content/uploads. Find the subfolder with your site’s ID and upload its contents to the wp-content/uploads folder in your new site.
  • If the network is an older one and has a blogs.dir folder, that will also contain a folder with your site’s ID. That will then have a subfolder called files. Copy the contents of the files folder to the wp-content/uploads folder in your new site.

Note: you may need to delete any folders WordPress has created in your new uploads folder to avoid any clashes.

Once you’ve done all this, activate any themes and plugins.

Now that you’ve installed your themes and plugins, you need to import the database tables.

Before you upload the tables from your old site, you’ll need to delete the duplicate ones which WordPress has added to your new site.

In phpMyAdmin, drop the following tables from your database:

  • wp_commentmeta
  • wp_comments
  • wp_links
  • wp_options
  • wp_postmeta
  • wp_posts
  • wp_terms
  • wp_term_relationships
  • wp_term_taxonomy

The screenshot shows my database with just those tables selected:

moving-a-site-out-of-wordpress-multisite-phpmyadmin-dropping-tables

Select them, click on the With selected: dropdown box, and select Drop. When prompted, click Go.

Note: Don’t delete the wp_usermeta or wp_users tables, unless you’ve chosen to copy these across from the network as well (see above).

Next upload the database you’ve edited:

  • Click the Import tab.
  • Click the Choose file button.
  • Select the sql file you’ve edited and click Choose or OK.
  • Click the Go button.
  • After a while (depending on the size of your database), you will see a message telling you the upload has successfully finished.

Clear your browser’s cache. This avoids any problems you may have if the browser has cached content from the old site.

Now log in to the WordPress admin for the remote site. If you moved the user tables across, your login details will be the same as for your old site, but if you didn’t, these will be whatever you specified when you installed WordPress in the new location.

Visit the Permalinks screen and turn pretty permalinks back on.

Check that all your links are working ok and that widgets and plugins are behaving as they should. If not, you can either step back through the process, using your backups where you need to, or simply set up the plugins and widgets from within your new site.

Once you are completely happy that everything’s working as it should, remove the site from your Multisite installation. I’d recommend leaving this a week or so in case you spot anything that hasn’t moved across. In the meantime, you can configure the old site’s domain to map to the new one, either by using a plugin or in CPanel.

Phew! It was a long and slightly complicated process, but you’ve done it.

Migrating a site out of WordPress Multisite and into its own installation isn’t something you can do quickly or without being very thorough, but it is possible and I’ve done it a few times. If you follow the steps above and make sure you have backups in case of any problems, then you should find it works smoothly for you.

 

FROM http://code.tutsplus.com/tutorials/moving-wordpress-moving-a-site-out-of-a-multisite-network–cms-22772
Rachel McCollin

WordPress Developer and Writer, Birmingham UK
Rachel McCollin is a WordPress developer who writes books, articles and tutorials about web design and development, with a focus on WordPress and on responsive and mobile development. She runs a web design agency in Birmingham, UK and has published three books on WordPress, including WordPress: Pushing the Limits, an advanced resource for WordPress developers. She’s currently writing her fourth book.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato.