How to Move Multiple WordPress Subdomain Blogs to a Single WordPress 3 Multi Site Blog

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:

  1. 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…
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. The difference between Activate and Network Activate for plugins is:
    1. Network Activate enables a plugin across all sites within the network;
    2. Activate enables a plugin for the local site it is activated within (one site).
  8. 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.
  9. 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.
  10. 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.
  11. 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
    1. /an-included-file.html
    2. /subdirectory/an-included-file.html

    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.

  12. 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…

Merge Multiple WordPress Subdomain Blogs to a Single WordPress Multi Site Blog

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:

  1. Exporting Your Subdirectory Blog
  2. Importing your old blog into your new blog
  3. Mirroring Settings
  4. 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

WordPress 3 - Exporting a Website

  1. Login to the WordPress site you intend to export (the old site).
  2. Ensure the site software (WordPress), plugins and themes are up-to-date.
  3. 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).
  4. 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.
  5. Now export your WordPress blog’s content as a WordPress WXR (XML) file’
    1. Go to Tools>Export
    2. 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.
    3. Click “Download Export File”
    4. 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.
  6. 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.
  7. 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.

WordPress 3 - Creating a New Site

  1. 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).
  2. Login to your WordPress Multi Site (main domain).
  3. Go to Appearance>Themes>Network Themes (it is a link at the top of the page). Enable the themes for network wide use.
  4. 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).
  5. Still in the Super Admin panel, hover your mouse cursor over the name of the site you just created and click “Backend”.
  6. Go to Posts then trash the welcome post.
  7. Go to Pages then trash the About page.
  8. Go to Links, select them all then delete them all.
  9. Go to Themes and activate the theme used in the old site.
  10. Go to Settings and set General, Writing, Reading, Discussion, Media, Privacy and Permalinks to the way they are configured in the old site.
  11. Go to Plugins and activate the plugins used in the old site.
  12. Mirror the old site’s plugin settings (see part three).
  13. Go to Appearance>Widgets then position and configure any widgets as they appear in the old site.
  14. Deactivate the autopinger built into WordPress. Delete the list in Settings>Writing>Update Services (back it up first!).
  15. Install Cimy User Manager and use it to import your user data. Be aware that user passwords might change.
  16. If you have hotlink protection setup on your server, disable it.
  17. Go to Tools>Import.
  18. Click WordPress to install the WordPress Importer.
  19. Click “Activate and run”.
  20. 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.
  21. Click “Upload File and Import”.
  22. Wait a minute for the file to upload…
  23. Follow the instructions provided. Be sure to tick the bottom box “Download and import file attachments”.
  24. When the file is successfully imported you will receive an “All done. Have fun!” message at the bottom of the importer page.
  25. If you created multiple export files repeat steps 17 through 22 until all Export files have been imported (aren’t large sites a pain?).
  26. 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:

  1. Activate the plugins required for the new site from within the new site’s backend.
  2. View the admin panel for both the old and new site in different tabs of the same browser window.
  3. Go through the settings of the old site, one-by-one, and configure the new site to match them.
  4. 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

  1. Go to Super Admin>Sites.
  2. Hover your mouse cursor over the name of the site you wish to edit.
  3. Click Edit.
  4. Under Site Info (wp_blogs)
    1. change the site’s domain name to that of the old site.
    2. 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.
  5. 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.

35
Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of

Thanks. I gave your post a plug here: http://forums.digitalpoint.com/showthread.php?t=1846977

I’m sure a lot of people will want to get up to speed on this soon.

hi,
i enjoyed reading your article, excellent information. i am running wp mu 2.6.5 and would like to upgrade directly to 3.0 but i’m worried that i will run into trouble.
do you think it is possible to do a one step upgrade (ommitting wpmu 2.7 2.8 and 2.9) to wp (mu) 3.0?
i’m only running 5 subdomain blogs on the mu installation, but it would be great if i don’t have to export and re-import databases manually.
thanks for help in advance

Someone knows how to create again a virtual subdomain that I deleted due to a mistake?
as I know it is not possible to create again a subdomain in wordpress 3

please, some help

Thanks!

I have the database ok.
in wordpress 3 I created a virtual domain like barcelona.mydomain.com then I deleted it. and now I want to create it again but wordpress does not allow me unless I reinstall wordpress again.
Any solution?
Many thanks!

Thanks for your answer!.I created a real subdomain and then deleted it. Thats why now my virtual subdomain doesn’t work as you said (works dashboard but not the site)
It seems for me not easy as I don’t have experience in PHPMyAdmin, but I have to try it!
Thanks again

Searching tables but It seems ok for me, Nothing in wp-blogs or wp-options. only some tables in slimstat folder. maybe this is not the way but thanks for your answer!

Oh!! thanks
I use google chrome and…
I try it with explorer and its working!
All this headache and was only a Chrome issue.
The other browsers are ok! I don’t know but with chrome I cannot see the site it redirects me to a plesk site…
thanks

RJ

I ran into an issue with steps 4 and 5 in your instructions. I am able to complete step 4 and create my new site as newblog.example.net, which is different from my previous site which I am migrating into as instructed. The trouble is when I hover and click on “Backend” of the site I just created at newblog.example.net, it seems to be looking for the wp-admin file from a WP install that doesn’t exist yet. Where am I going wrong here? Did I miss a step or did you forget something in the instructions? Plz help! Thanks 4. Go… Read more »

I was trying to move the theme from http://www.domain.com/wordpress to http://www.domain.com and deleted the “/wordpress” part from the backend “wordpress URL”. (all in wordpress) Now, I can not log back in to fix the problem. Do you have any suggestions?

Thank you in advance!

WP’s import/export plugin doesn’t include settings, user data, plugin data, etc, so I worked out a different process that will migrate everything by tweaking and copying the database tables directly. I wrote up a detailed description if anyone is interested.

Thanks so much for a really thorough and helpful post. So useful.

Nice work!

::-)

Thanks you… you are a real true contributor to the WordPress community.

Anonymous

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. 

It is indeed possible but I don’t advise it. The WordPress database table has record names that look something like this: wp_options, wp_posts, wp_comments… (I’ve not checked those names for accuracy). Additional sites on the network use the same database table but their records have names that look similar to these: wp_1_options, wp_1_posts, wp_1_comments… The number represents the numerical ID of the blog/site within the Network. Though it’s possible to use separate database tables, each with its own login details, not all plugins use separate records per site. For example, The Multipress plugin installs one record as wp_multipress. That same… Read more »

Free to your inbox

Join our mailing list to receive the latest news and updates from JournalXtra.

You have Successfully Subscribed!