Migrating from multiple wordpress vhosts to multisite setup

February 11, 2017 574 views
WordPress

Having configured multiple WordPress sites on a single LAMP machine (Ubuntu 16.04.01) by replicating the WordPress code into multiple home directories ( including individual ssl certs) I've just discovered the WordPress multisite feature.

Can I integrate all my sites into one multisite one. If so how?

Each WordPress site has its own (different) domain name. What I've done is:-

Created LAMP server
Created multiple virtual hosts
Set up SSL certs (Lets encrypt) for each vhost
Individual mysql databases for each server.
3/4 just have default placeholder stuff
1/4 real user data

Is WordPress multisite more for multiple blogs under 1 domain name?

2 Answers

Is WordPress multisite more for multiple blogs under 1 domain name?

Well. That's true. In addition, each blog can be attached to its own domain name too. WordPress multisite is a pain to manage on certain circumstances. See https://halfelf.org/2011/dont-use-wordpress-multisite/ (old article, but the points in it are still valid)

There is an official guide on migrating multiple blogs into multisite.

@alex5ef00c845425364045b61c

It is possible to migrate from single to multi-site, though it can be a little finicky and requires plugins to enable certain features / configuration options.

NOTE: Before doing anything, create backups of your existing sites (data + database). If only one of them has data that matters (as per your post), then you may not need to backup the other three.

After you've backed up your data, the best thing to do, IMO would be to enable multi-site on the site that has valid data (i.e the 1/4 real user data site). That'll be your "default" site once multi-site is setup and you can then re-add the others as new blogs. I suggest this since you note that the others do not have any real data on them.

You would then need to open up wp-config.php and find:

/* That's all, stop editing! Happy blogging. */

Above this line, add:

define( 'WP_ALLOW_MULTISITE', true );

Save the file, upload it back to your site, and refresh ./wp-admin.

Network Setup

Now under Tools, click on Network Setup. You'll have two options for setup -- you can either setup sub-domain based networking, or directory based networking.

Sub-Domain or Sub-Directory

If you're wanting to enable SSL on each domain, if you enable sub-domain based networking, you will need to purchase a WildCard SSL Certificate. LetsEncrypt doesn't support these types of SSL Certs so there's no way of getting this one for free. If you choose directory based networking, you can make do with LetsEncrypt certificates (which are free, and valid).

Plugins

When it comes to WordPress, it doesn't natively support domain mapping (i.e. mapping a domain to a blog) out of the box, so you need to install a plugin to handle this for you.

Right now, there's two main options for this:

WordPress MU Domain Mapping

https://wordpress.org/plugins-wp/wordpress-mu-domain-mapping/

For setup of the above plugin, I'd take a look at the guide here.

Domain Mapping by WPMU

https://premium.wpmudev.org/project/domain-mapping/

DNS

For each domain that is mapped to your installation, you'll need to make sure the A entry for the domain matches that of the main domain used for the WordPress multi-site installation (i.e your Droplet IP).

Quirks

It does take a little bit of work to get Multi-Site working the way you want it and there are a few quirks.

It's far easier to migrate in to multi-site than it is to migrate off it, something to keep in mind. Plugins also function a little differently since network mode is in play. Instead of each site being able install anything, you have to enable a plugin from the network admin and then enable it on the site. Not all plugins will work in network mode as well, so if you run in to issues with a plugin, that's most likely the reason.

Have another answer? Share your knowledge.