What a mouthful that title is! Just wait ’till you read the next sentence. If, like me, you installed a few WordPress blogs into subdomains before the advent of WordPress 3 with Multi Site features and you now want to consolidate your blogs into a WordPress 3 network with all subdomains managed from one WordPress Multi Site installation then you will need a little tutoring about how to convert your multiple blogs into one Multi Site blog network. I have successfully moved many subdomain installations into a single Multi Site installation and now it’s time for me to be nice and let you know how to do it. So grab yourself a drink and get comfortable because you could be in for long read and a few hours work if you have a big site to export. If your site is small then it will take you about 30 minutes to import to a virtual subdomain. Good luck!
Before you start you need to be aware of a few things:
- Check that the plugins and theme(s) used by your individually installed blogs are compatible with WordPress Multi Site. Most plugins and themes will function faultlessly but when they go wrong…
- A fault in any one of the sites in your Multi Site set-up could bring down your complete network. To my knowledge, the only faults that will bring down your network are plugin, theme and database related. Plugin and theme errors are easily fixed by the deletion or removal of the faulty plugin’s or theme’s files from /wp-content/plugins/ or /wp-content/themes/, respectively.
- WordPress Multi Site subdomain (and subdirectory) sites all use the same database as the parent (non-subdomain) site. It is possible to give them a database of their own and I will explain how to do that in a later article. If the database breaks try to repair and optimize it with PhpMyAdmin or whatever your host’s database management software is. Back up your database regularly.
- A regular WordPress installation (non- Multi Site) uses the default table prefix of WP_ for all of its tables. The Multi Site database is a little different: the table prefix for the first (primary/main/top) site uses the table prefix WP_ and all other sites have the table prefix WP_n_ (where ‘n’ equals a site’s number); the prefix number is usually equal to a site’s creation order and is the same as its unique storage directory’s number (under wp-content/blogs.dir). For example, the main blog uses the table prefix WP_ and the upload folder wp-content/uploads; the first addon site will use the table prefix WP_1_ and the upload folder /wp-content/blogs.dir/1.
- The deletion of an addon site will remove its table data from the database and its upload directory from /wp-content/blogs.dir. The creation of a new site or recreation of a deleted site will not fill-in any numerical gaps in the database table structure or the /wp-content/blogs.dir directory structure. For example If you delete the most recently created site and it uses wp_3_ and /wp-content/blogs.dir/3 then recreate it, it will use wp_4_ and /wp-content/blogs.dir/4; no site will ever again use wp_3_ and /wp-content/blogs.dir/3.
- Plugins installed by the main site’s administrator are usable by all blog authors if “Enable administration menus>Plugins” has been ticked under Super Admin>Options. For example, if you have 10 subdomain blogs created by 10 authors and you (the administrator) have installed 100 plugins then all 10 users will have access to all 100 plugins.
- The difference between Activate and Network Activate for plugins is:
- Network Activate enables a plugin across all sites within the network;
- Activate enables a plugin for the local site it is activated within (one site).
- Plugin settings do not cascade through every networked site i.e. if you install the TinyMCE Advanced plugin to to improve the native WordPress visual editor then the changes you make to one site’s editor will not be effected within other sites of the network. Unfortunately there is no way to enable network wide plugin settings changes, yet.
- Every subdomain or subdirectory site added to a WordPress MS network is given its own storage space in /wp-content/blogs.dir/[site number]/. Even so, some WordPress Multi Site folders are shared by all sites within the network that sit on the same domain. Those shared folders include all the ones under /wp-content except /wp-content/uploads and /wp-content/blogs.dir.
- Multi Site subdomains are virtual entities. Do not bother to look for them, you will not find them because they only exist in the site’s database. You can read more about how this is accomplished here.
- When including files into a single domain site (non Multi Site), you would usually place included files in the installation’s root directory (/) or in some subdirectory of the root directory, for example
Multi Site site’s function in exactly the same way. Included files are placed under the main domain’s root folder and are referenced relative to that root folder. Be careful not to muddle up the names of the files included in each of your sites.
- A virtual subdomain created with Multi Site will neither override nor overwrite a real subdomain so even if you create a real subdomain called one.domain.tld and a virtual subdomain called one.domain.tld (both have the same address), the only one that will be served to visitors will be the real one; the virtual one will be hidden until the real one’s DNS record is deleted.
Now that you’re a little more knowledgeable, let’s move onwards and upwards…
You must enable the Multi Site features of your WordPress site before proceeding beyond here. Read this JournalXtra guide to learn how.
This guide is split into 4 parts:
- Exporting Your Subdirectory Blog
- Importing your old blog into your new blog
- Mirroring Settings
- Deleting the Real DNS Record
Each part contains a step-by-step guide to effecting its title. If you get stuck, either google for an answer or ask a question in the comments. Better still, do both. I will answer all questions within 24 hours (except Saturdays, I don’t work Saturdays).
Getting rid of multiple WordPress installations in favor of one Multi Site installation can be a good idea for those who want to save a bit of space and who need to have easy access to their sites’ admin pages with a one-time login to only one of the sites within the Network. It probably isn’t a good idea if the sites to be transfered have a lot of custom files included within them; and it can take a painfully long time to transfer a site when the site being moved is large.
The general method of transferring your subdomain site to your Multi Site subdomain site is easy. Complications only arise when plugins, themes and included files are incompatible with WordPress 3 MS so check compatibility first.
For the benefit of non-English speakers, here are two important definitions:
- Export: to send out.
- Import: to bring in; to put in.
Export is the opposite of import. In relation to this article, to export means “to copy or backup a WordPress blog” and to import means “to load the content of one blog (the exported one) into another blog”.
That said, follow this guide to export a single subdomain blog installation into a Multi Site blog installation; or, put another way, follow this guide to learn how to import an old WordPress blog into a new Multi Site blog.
Part One: Exporting Your Subdirectory Blog
- Login to the WordPress site you intend to export (the old site).
- Ensure the site software (WordPress), plugins and themes are up-to-date.
- Delete any spam comments and old post revisions (assuming you do not need or want them). Use the WP Optimize plugin to facilitate that. Once installed, go to Dashboard>WP Optimize and select all applicable options (use your own judgment).
- Use your server’s file manager or an FTP program to compress (zip) and download the content of your plugins, themes and uploads directories (/wp-content/plugins, /wp-content/themes, /wp-content/uploads) and any other custom directories that contain data required by your posts. This step can be skipped but it’s alway good to have a backup.
- Now export your WordPress blog’s content as a WordPress WXR (XML) file’
- Go to Tools>Export
- Check the filters. The default filter settings should be good enough for small sites. If the site is large you will need to export its content in date segments.
- Click “Download Export File”
- Check the downloaded export file by opening it in a text editor and scrolling to its bottom to look for any error messages. You will need to reduce the amount of data exported to it if there are error messages. Reduce the data site by filtering for date, category and/or tag data. Over large file exports sometimes result in “out of memory” errors. Export files over 2.8mb will result in import errors on upload. A WordPress WXR export file splitter can be used to split large export files. A WXR file splitter can be downloaded from here (Works on Windows, Linux and Mac). A good indication that an export file complete is the </rss> tag. When you check the export file, look for the </rss> tag at its bottom.
- If you have any custom directories to back up then you should use an FTP program (File Transfer Protocol program) to download them; or you can use your server file manager to move them directly to the main domain’s root directory (or somewhere relative to it that matches their current location within the subdomain or subdirectory.
- Install Cimy User Manager to export your site’s user data (usernames, email address, website etc…).
That’s that for backing up your WordPress blog; now it’s time to import it into your Multi Site.
Part Two: Importing your old blog into your new blog
This can be tricky. It requires FTP access to your server either via an FTP program else via your server’s File Manager. I generally use my server’s file manager.
- Use your FTP manager or host provided File Manager to upload and extract the Plugin zip file to /wp-content/plugins/ and your Theme zip file to /wp-content/themes/ of your root Multi Site domain. Do not activate your plugins just yet. Take care not to overwrite customized plugins and themes (rename them if you need to).
- Login to your WordPress Multi Site (main domain).
- Go to Appearance>Themes>Network Themes (it is a link at the top of the page). Enable the themes for network wide use.
- Go to Super Admin>Sites and create a new site. Use a name other than the name of the site being imported. For example, if you’re importing from old.domain.tld then you could create a Multi Site site called new.domain.tld but not old.domain.tld (we will change the Multi Site site’s name to the original subdomain site’s name in a later step).
- Still in the Super Admin panel, hover your mouse cursor over the name of the site you just created and click “Backend”.
- Go to Posts then trash the welcome post.
- Go to Pages then trash the About page.
- Go to Links, select them all then delete them all.
- Go to Themes and activate the theme used in the old site.
- Go to Settings and set General, Writing, Reading, Discussion, Media, Privacy and Permalinks to the way they are configured in the old site.
- Go to Plugins and activate the plugins used in the old site.
- Mirror the old site’s plugin settings (see part three).
- Go to Appearance>Widgets then position and configure any widgets as they appear in the old site.
- Deactivate the autopinger built into WordPress. Delete the list in Settings>Writing>Update Services (back it up first!).
- Install Cimy User Manager and use it to import your user data. Be aware that user passwords might change.
- If you have hotlink protection setup on your server, disable it.
- Go to Tools>Import.
- Click WordPress to install the WordPress Importer.
- Click “Activate and run”.
- Browse for the XML file downloaded when you exported your single WordPress subdomain site’s content. If you created several Export files you should import them all, individually.
- Click “Upload File and Import”.
- Wait a minute for the file to upload…
- Follow the instructions provided. Be sure to tick the bottom box “Download and import file attachments”.
- When the file is successfully imported you will receive an “All done. Have fun!” message at the bottom of the importer page.
- If you created multiple export files repeat steps 17 through 22 until all Export files have been imported (aren’t large sites a pain?).
- Use PHPMyAdmin to export and import plugin specific tables: view the database for the old site, click the Export tab, select only those tables that relate to specific plugins (e.g wp_polls, wp_topposts; do not export WP_Options; do export WP_links if you want to copy your old sites blogroll links), click Go at the bottom. View the Multi Site database, workout which table prefix is for your new site then use a text editor to find and replace WP_ with WP_[number]_ (replace [number] with the new site’s database table prefix number). Next, still viewing the Multi Site’s database, click import and import the edited database export file. Always backup your database before you import into it. You might need to import tables one at a time. If you get an import error, drop the table that’s causing the error (from the new site’s database) and import it again.
Part Three: Mirroring Settings
I have looked and not found an easy way to export and import plugin and WordPress settings. Were I a plugin developer I would definitely buy myself some traffic by creating one. I’m sorry but there is only one way to transfer the settings from your old (exported) WordPress site into your new WordPress site; it must be done manually.
Some plugins and some themes have an import and export option built into them. I recommend the themes Suffusion and Atahualpa for that reason. I believe the Redirection plugin lets you import and export redirections; and some shopping carts allow their settings to be exported and imported. Check your plugins to see if any let you export their settings – it could save you a bit of time.
Mirroring the old site’s settings in the new site is easier said than you might think:
- Activate the plugins required for the new site from within the new site’s backend.
- View the admin panel for both the old and new site in different tabs of the same browser window.
- Go through the settings of the old site, one-by-one, and configure the new site to match them.
- Point your web browser to the new site’s URL (new.domain.tld) and be sure that it functions as the old site did and as you want the new site to function.
If the site is successfully mirrored
- Go to Super Admin>Sites.
- Hover your mouse cursor over the name of the site you wish to edit.
- Click Edit.
- Under Site Info (wp_blogs)
- change the site’s domain name to that of the old site.
- Under every other available setting, update all URLs to match the site’s new name. For example, if the old site is at old.domain.tld and the new site is at new.domain.tld, you should have changed new.domain.tld to old.domain.tld and every occurrence of new.domain.tld should be changed to old.domain.tld.
- Click “Update Options”.
DO NOT VIEW THE SITE JUST YET – YOU WILL ONLY SEE THE ORIGINAL ONE IF YOU DO
Part Four: Deleting The Real DNS Record
This is the final, and most hazardous, part.
When both a real and virtual subdomain exist with the same name the real subdomain’s DNS record must be removed to enable the site hosted by the virtual subdomain to show when viewed with a web browser.
Typically (with cPanel, anyway), the deletion of a subdomain’s DNS record does not delete the files within the directory the DNS record is created against. If you want to be safe, back-up your real subdomain’s files before proceeding. I accept no responsibility for your actions!
As you likely created your original subdomain, I’ll leave you to work out how to remove it (this is not the one created within WordPress MS). Usually this involves clicking “Subdomains” in your web host control panel (e.g. cPanel), finding the relevant subdomain (e.g. old.domain.tld) and deleting it. Do not delete its directory, just its DNS record.
Once the real subdomain has been deleted, point your browser to the new version of the old site. The address will be the same as the old subdomain (e.g. old.domain.tld). If it doesn’t load it means something has gone wrong or you’re looking at the wrong URL – take corrective steps.
Check the URLs. Make sure the browser address bar shows the same URL for the posts viewed as would be displayed were you viewing the site at the original (real) subdomain, ensure links still point to their proper places, check that images load properly and link properly. Delete the real subdomain directory if you’re satisfied the new Multi Site site functions as it should and that you no longer need any of the files contained within it.
Recreate the subdomain DNS record if you want to revert to the original (real subdomain) site (backup the directory first). If you do revert back to the original version of the site, you can safely remove or deactivate the virtual WordPress subdomain site from your Super Admin control panel.
You have done incredibly well if you’ve come this far. You should be proud of yourself for successfully transferring your old subdomain installation to a new WordPress Multi Site controlled virtual subdomain installation.
And, now, after writing these 2731 words during most of today’s hours, I am going to get back to setting up my new website which advertises my WordPress Installation and Set Up business – yes, I can be hired to do this for you. Prices vary according to the size of each individual site and the number of individual sites to be relocated. Visit WP Service Masters to learn more.