We wrote about:

Moving the domain of a WordPress multisite install

In case you’re looking to move a WordPress site with Mutlisite and not sure where to start, hopefully the notes below will save you a bit of time. If you’re looking to move a regular site, then check out this page here: http://codex.wordpress.org/Changing_The_Site_URL

In a Multisite install, the domain and path get populated more times in the database, so it just requires a few more tweaks to get up and running.

To move your site:

  1. TAKE A FILE & DATABASE BACKUP!
  2. Transfer all web files and the the database to the new server
  3. wp-config.php – Open your config file and update the database connection and the fields:
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'mydomain.com' );
    define( 'PATH_CURRENT_SITE', '/' );
  4. .htaccess – Open your .htaccess file and confirm or update the line: RewriteBase /
  5. Login to your PHPMyAdmin and open the database
  6. Open table ‘wp_options’ and adjust the fields ‘site_url’ and ‘home’
  7. Open table ‘wp_blogs’ and adjust the domain and path for all entries
  8. Open table ‘wp_site’ and adjust the domain and path
  9. Open table ‘wp_sitemeta’ and adjust the field ‘site_url’
  10. WordPress Multisite stores the standard WordPress tables for each blog with the incrementing prefix e.g. wp_1_ , wp_2_, wp_3_ … so you need to open up the ‘wp_*_options’ table for each and adjust the fields ‘site_url’ and ‘home’
  11. TAKE A DATABASE BACKUP!
  12. We then need to run a SQL command to update the GUID for each of the blogs incrementing the table as before:
    UPDATE wp_posts SET guid = REPLACE (guid,
    'http://exampleoldsiteurl.com',
    'http://examplenewsiteurl.com');
  13. Repeat the above and replace ‘guid’ with ‘post_content’.
  14. Run your site

You should now be ready to roll. If you get a connection message, then it is likely some paths are still not correct… if you get a white screen, then you’re best bet is to check your active templates are all in place.

wp-mutlisite

16/09/2010

Written by James Montgomery, Designer & Developer.

Back

  • Anthony

    Are you for hire to do this process?

    Thank you,
    Anthony

    • imran

      Hi james Thanks very much for being detailed and giving the fix can you available for a small task i am getting a little trouble to move

  • mike

    Thank you for posting this! I had a few quick questions. I followed everything to a tee and got the root site up and running, but my subdomain sites are still pointing to the old domain, so I’m not sure if I’m missing an edit in the db or if that has something to do with my htaccess file (which contains the default values that WP gives you during the network setup instructions). Also, in the step where you run the SQL command with the exampleoldsiteurl.com/examplenewsiteurl.com, do we enter just the root for everything or full address for each subdomain sites (ie. subdomain1.exampleoldsiteurl.com/subdomain1.examplenewsiteurl.com)? Again, thank you so much for these instructions!

  • http://www.realisingdesigns.com James

    @Anthony – Glad you got it working, not the nicest of tasks to have to do!

    @Mike – I hadn’t used the subdomain route, so am not sure this will work. I would say that all the steps still apply. Your .htaccess file is also not domain dependant, so should work fine for you… I think the area you need is the sub-domain wildcards in httpd.conf – hope that helps.

    James

  • Art

    hi,

    i need to migrate JUST 1 subdomain from a multi-site –> a new server/Subdirectory WP install.

    will this technique u posted work for that ?
    or will it migrate ALL the sites?

    thanks!

    art

  • Anonymous

    @art – I think with some care the above would likly work just running the update for that blogs tables e.g. ‘wp_3_’ of whatever it might be. This will update the blog itself and then you should be able to update the main tables for that blogs location … for example check out the ‘path’ field in the table ‘wp_blogs’. Hope that is of some use.

  • Yourmanstan

    thanks for this… the instructions on codex were not nearly as useful

  • http://www.dangayle.com/ Dan Gayle

    I just discovered the hard way that a) I never want to move a WP Multisite again and b) I never want to move a WP Multisite again. Between the DB itself being a nightmare to move and having to update all of the references within the DB, I want to pull my hair out.

  • http://www.dangayle.com/ Dan Gayle

    I just discovered the hard way that a) I never want to move a WP Multisite again and b) I never want to move a WP Multisite again. Between the DB itself being a nightmare to move and having to update all of the references within the DB, I want to pull my hair out.

  • http://twitter.com/SeoKungFu Boris Krumov

    Thank you so much!
    I only needed to go trough post_content fields of the posts’ tables because they still contained old links after the other changes.

  • Scott

    You are a lifesaver – thanks for this – worked perfectly!

  • D.Lo

    Wow, this resource was absolutely incredible.  This plus a little playing around, a little common sense, and a little brute force and ignorance and I successfully migrated my multisite to staging server.  YES!  Thank you!

  • http://twitter.com/kcrusher Keith Crusher

    THANK YOU! This is the best instruction I’ve found on how to do this properly!

  • Kajal432

    Thanks a lot. I owe you a beer

  • Sarah

    This was a HUGE lifesaver for me. I was looking at this task like it was soooo daunting (which it was). But with your instructions it really took me only a few hours (most of that was transferring files). Thank you so much for taking the time to write this out.

    • http://www.realisingdesigns.com James Montgomery

       You’re welcome – glad it was of use and your migration went well :)

  • http://amypospiech.com/ Amy

    Thanks, this is exactly what I was looking for and helped me fix the WSOD. Other articles about single-site WSOD suggested taking out all but the default theme.. your tip at the end clued me in that this is not the case for MS, and along with all your other suggestions helped me get the migration working! Thanks.

  • Josh Lobe

    Very impressive.  I’ve been working with WordPress about six months.  This is the first client I’ve attempted to move a multisite configuration for.. and was dreading it severely.  

    Your guide here not only restored my confidence to attempt the move… but also provided extremely useful, step by step instructions which I was able to follow to the letter.

    Everything moved perfectly; everything was exactly where you said it would be in the database; and all commands executed without any issues.

    I don’t know how I would have fared on this without your guide here, but I do know you saved me about six hours of digging through the database figuring out what options needed to be adjusted.

    One million “Thank you’s” to you!!

  • http://www.chriskrycho.com/ Chris Krycho

    This was quite excellent. One note: the phpMyAdmin panel may not show the home category by default in the short list it displays, so people may have to update the number of records to display in wp_options to see it. Not a big deal, but worth note.

    Thanks for the writeup!

  • asdf

    Oh good, thanks you very much. it will safe lives!!!!

  • Alice Ralph

    *breathes sigh of relief* This just made this so much simpler. THANK YOU!

  • http://twitter.com/JupiterVisual JupiterVisual

    worked perfectly. THANK YOU.

  • jch

    I just want to thank you for these very clear and precise instructions. I truly thought that migrating a multi site would be a huge hassle and would never work the first or even the fourth time. With these instructions it worked the first time and I am hardly an expert!! Well done!

  • Paul

    Amazing instructions! It worked like a charm:D Thank you

  • alby111

    Thanks a lot, the best I found after a lot of searching!

  • rAzeTea

    We then need to run a SQL command to update the GUID for each of the blogs incrementing the table as before:
    UPDATE wp_posts SET guid = REPLACE (guid,
    ‘http://exampleoldsiteurl.com’,
    ‘http://examplenewsiteurl.com’);
    Repeat the above and replace ‘guid’ with ‘post_content’.
    Run your site

    I don’t get this part.

    • http://www.realisingdesigns.com James Montgomery

      Hi rAzeTea, so for that step you need to run two SQL commands in say PHP MyAdmin (after backing up your database). The first being:

      UPDATE wp_posts SET guid = REPLACE (guid,’http://exampleoldsiteurl.com’,’http://examplenewsiteurl.com’);

      Making sure to update the URL and table prefix (if needed)… then run a second command of:

      UPDATE wp_posts SET post_content = REPLACE (post_content,’http://exampleoldsiteurl.com’,’http://examplenewsiteurl.com’);

      Hope that helps.

  • Edu

    Hi, do i need modify/update all blog id´s wp_posts? ->
    wp_posts, wp_2_posts, wp_3_posts, wp_4_posts etc.?

    • http://www.realisingdesigns.com James Montgomery

      You would need to run through each blog as you say, running the two commands to update wp_posts and wp_content… hope that helps