Migrating WP into MULTI-SITE (sub-site)

multi sub-sites

Change Single WP site into Multi-Site (MS)

WordPress Multisite is an excellent feature. Even if you want to use only one site, you’d better to create a MS wordpress installation, and then use the first sub-site as the MAIN SINGLE SITE. (If you dont know MS functionality fully, at first,  I RECOMMEND YOU TO SPEND ABOUT A HALF AN HOUR to understand what it is. You can read about it  here )

Then,  you can start:

(Step 1) Setup the main domain

Let’s say, you want to setup MultiSite WordPress at example.com, having like:

  • example.com/james
  • example.com/elsa
  • etc…

At first, simply enable MS feature there (read this or this).

Now let’s say, you are migrating james.de (or even  example.com) into  example.com/james.  In example.com dashboard, create a sub-site named james. Now, remember which ID is assigned to that sub-site

site id in network

Let’s say, it is 2 (note usage of this number in the rest of this tutorial. OF COURSE, YOU SHOULD CHANGE IT WITH YOUR ACTUAL ID).

Continue reading…

 

(Step 2) edit SQL with phpMyAdmin

In most cases, I wont recommend to use the built-in Export/Import feature in such cases, because you might lose IDs, permalinks and etc.. So, the best way is to migrate UNTOUCHED DB correctly.  During the migration, we will have to REPLACE SOME STRINGS INSIDE DATABASE, for which I HIGHLY RECOMMEND Database Migrator script (instead of simple TEXT-EDITORS, because  if you’ll replace strings manually using text-editors, then SERIALIZED ARRAYS wont be re-calculated, and site wont function correctly! ).

At first, Export database SQL file from james.deusing phpMyAdmin (Note, make 1 additional copy of that SQL for a backup). Now, in the SQL file, replace all occurrences of:

  • wp_user_ with w_2_user_
  • `wp_ with `wp_2_ ( After replacement, just rename w_2_users back to wp_users  [and same with w_2_usermeta ],  because they should stay as is )
  • wp_capabilities with w_2_capabilities
  • james.de/ with example.com/james/ (also, read [popupi 1]THIS NOTICE (popup)[/popupi] after conversion )
  • /uploads/ with /uploads/sites/2/ (note,it’s a bit tricky… After replacements, manually search for /uploads/ phrase, to ensure that you havent accidentally replaced external links i.e. microsoft.com/uploads/sites/2/ )

(Step 3) Avoid user ID conflicts

Now remains most important part: users! To avoid conflict between user IDs, enter in example.com database: in wp_users and wp_usermeta, replace the ADMINISTRATOR (and all other users) IDs to random number i.e. 321 (WHICH USER ID DOESNT EXIST IN james.de‘s database).

(Step 4) Move files

Now, Files & Folders: move all contents from james.de/wp-content/uploads/ in example.com/wp-content/uploads/sites/2/ folder.
Also, do this check in Database.

(Step 5) Importing DB

At first, delete in example.com database, delete all tables starting with w_2_, and now I think you are ready to import the james.de‘s our modified SQL file. (During import, if there happens any SQL errors, then fix them –   BTW, another recommended way could be to import the tables one-by-one  usng PHPMYADMIN’s SQL Tab, where you can copy&paste contents from SQL file to be executed directly. Thus, you will see directly which table might give you import errors).

(Step 6) Specific notes

After importing, read these [popupi 3]notes (popup).[/popupi]

Finished !

If Import is successful, then visit your site! Congratulations!

(p.s. In addition, you can read these [popupi 2]nice tutorials (popup)[/popupi] too.)

If you find issues in this tutorial, or you want custom help of programmer, you can contact http://puvox.software/contact-us/.

3 thoughts on “Migrating WP into MULTI-SITE (sub-site)”

  1. Pingback: WordPress Multi-Language Plugins

  2. Pingback: default wp-config.php content (wordpress)

  3. Pingback: Migrate WP single Subdomains into WP Multisite – Puvox – Blog

Leave a Comment

Your email address will not be published. Required fields are marked *

Puvox - Blog
Scroll to Top