Today I found that I wanted to move my WPMU installation to a new domain. It doesn’t really matter why — that’s a whole other story really — but just in case you want to do the same thing, this is how I did it.
There are some caveats and other considerations before diving in and moving WPMU. You can see some of them in the comments below.
- Log in to phpMyAdmin where you can manage the WPMU database.
- Export the database to an sql file.
- Under the Operations tab, copy the database to another database as a backup: call it something like wpmu-backup and select “Structure and data” and “CREATE DATABASE before copying”.
- If you need to (I didn’t because I was using the same source folder) copy all the WPMU files into their new location.
- Open the exported sql file in a plain text editor (e.g. Notepad on Windows, TextEdit on Mac, or another editor of your choice) and perform a search and replace function on the old domain name, replacing it with the new domain name. Save that file.
- Under the Structure tab, select and drop all the tables in the WPMU database (the active one, not the backup).
- Import the sql file with the new domain name.
- Change the domain name in wp-config.php in the root of the WPMU installation.
- Check if anything needs changing in .htaccess (also in the root directory of WPMU); I didn’t have to change anything in this file.
That should be all you need to do. If something just doesn’t go right and you need to revert to the old installation: put the files back where they were (if you moved or deleted them rather than just copying them), undo the changes to wp-config.php, and change the name of the new database (under the Operations tab) to something else (e.g., wpmu-new) and change the name of the backed up database to the name of the active database that the blog uses. This should restore the blogs to the way they were before, in their old location.
Mat Packer says
Interesting….now if you can do a user guide telling how to migrate from WP standard to WPMU that would be super! I’ve got a client who I need to migrate with minimal downtime, at this point I’m thinking I might just take them down from Sunday midday through to late that night………
Andrea_R says
This is great! 🙂 The only other thing to watch out for, is if the setup uses the subdomain option, to make sure the new domain is also set up with wildcards.
@mat – there’s a step-by-step over here:
http://bavatuesdays.com/import.....tallation/
kristarella says
Mat — I would go about it one of two ways: if they’re not too fussed about post IDs and everything remaining exactly the same use the native WordPress export/import, orr export the tables from the database and import them into the WPMU database. The latter is exactly what the link Andrea gave describes, so yay!
Andrea — that’s a really good point! Thanks for pointing that out. I battled so much with subdomains on my MAMP install that I gave up, so I’m just using subdirectories.
Deborah Carney says
AndreaR I am trying to follow the link you posted and the WP install on that site is broken 🙁
Dr. Mike Wendell says
I’m sorry but I’m going to have to disagree with a fair amount of this. While the method given is a good start, there’s a couple of holes here.
1) The use of phpMyAdmin. Most folks quickly discover that phpMyAdmin doesn’t handle large *.sql files that well. You can usually get a decent export of them out of it;s interface but importing doesn’t usually go well. Timeouts are a big issue. We’ve seen the program miss a non charset character and wind up importing the sql commands as data. Usually either the command line or the hosting interface (they usually use command line scripts instead of working in php) would be a better way to go.
2) Use of Notepad. Same as #1 pretty much. Notepad will usually choke on files over a meg or two in size. It also saves as a default of ANSI and not UTF-8 which may also cause issues.
3) You’ll need a method of redirecting from the old site to the new one. You probably don’t need one if this is a new site but you will if this is an established site you’re moving. If you don’t, all the old inbound links will not work and you’ll have a large number of ticked off clients.
4) Search and replace the domain: This is one issue my clients and I have discussed a couple of times. Sure, the records in the options tables will need to be changed but what about the individual blog’s contents? Is it a link or just text? Do you modify a client’s content? Searching for the domain with the http:// bit on the front would probably be the way to go but then you run into a problem with the usernames within the blog urls if you;re using subdomains.
5) Replacement of the database. Have to admit that I would leave the original database alone and intact and work off of a new database. That way if anything goes wrong, you have the original still intact and ready to go. You’ll have to modify the wp-config.php file to use the new database but it’ll save you if you make a mistake somewhere.
Sorry to disagree with you,
-drmike
kristarella says
Deborah — try the link again, it works for me.
Mike — Liberal use of “disagree” there. Some extra things to think about for sure, and all of your points are good. I guess it depends on the situation: in my case I was moving a local install with about 18 blogs on it, each only having about 10 posts.
1. Thanks for the link I’m sure it will be very useful. This is a good consideration for a large database, I didn’t have a problem, but I will put a note in the post.
2. I have a general aversion to Windows and have barely used it in about four years. I was really just trying to illustrate what I meant by a plain text editor. I’m inclined to think that even that illustration wasn’t necessary: if someone is daring to play with WPMU I’m sure they already have a much better editor in operation.
3. Good point. Hopefully if that is a consideration in the move, the person moving their site wouldn’t need me to tell them that. All I was really trying to point out was the things that you need to do to see that WPMU works in the new location since it doesn’t support the changing of the site URL like WP does.
4. If you’re dealing with a client’s site there are a lot more considerations and a responsible web admin would need to think those through. Again, this is really just how to move it and get it working, not what are all the practicalities and ethics of moving and changing content. Another problem I had recently with a client blog (not on WPMU, just WP) they hade some URLs with www. in front and some not, so subdomains are a serious consideration there.
5. In my mind there is next to no difference between working off the original and using a new one (when there is an identical duplicate in the same process). I actually did use a new one when I moved, but in the instructions above we have both downloaded an sql file of the database as well as duplicated the database as a backup. It doesn’t make a difference to me which duplicate you choose to work with or whether you just want to make a new one, as long as there is a proper backup.
Thanks for your thoughts. While there may be more solid ways of doing this, and the things you’ve mentioned are important considerations for larger sites and sites that have been live for a while etc, the intro to the post does say “this is how I did it”. 😉
Chad says
We tried changing the domain on a MU installation and went late into the night trying to figure out why only the main blog worked but none of the others. We replaced in the .sql file with a new domain that included “www” and MU choked (purged?). We needed the www at the time because we used the domain with Active Directory and email. We had to make one small core edit in wp-settings.php (just one statement!) in order for it to accept our www domain. Requiring www is a petty decision in our minds, a feature to others.
Had we installed MU with the www domain in the first place, we would have received the ‘no-www’ error notice. We didn’t see this because of the search and replace behind the scenes.
kristarella says
Thanks for sharing your experience Chad. That is another thing to note: realising what MU can actually run on in the first place.
Mike says
Hi Kristarella,
Sorry, my comment’s off topic here, just like what you did with the design of your blog and wanted to ask a general question if I may
I see you use the thesis theme for your blog, which I’m considering getting for myself. Can you tell me whether you made changes to the code to get your design or were you able to manage it all with the custom css and the adjustments thesis allows you to make from the dashboard or wherever.
In particular, I was especially curious about getting the sidebars at the bottom of the page and some other cool things you’ve done
Mike
priscila says
thanks, it was so useful cause i have a problem with my installation i did that and works great… really helpful
Amjad says
Thanks! This was just what I needed to do! 🙂
Christina Gressianu says
Thanks for this! I tried to do this a couple months ago and managed to delete my whole blog. Ugh. Wish I’d read this first
Derek says
Thanks mate. Worked a treat.
Ari says
Hey again, Kristarella!
I just moved my wordpress to a different subdirectory. Everything looks okay, expect the blog doesn’t display correctly. I’m not sure what is wrong. Any ideas?
Thanks so much!!
kristarella says
Ari — is this related to WPMU? The link you left in your comment info goes to a page not found and I’m not sure if your comment is related to the post, so I don’t really know where to start hypothesising.
proposal tugas akhir says
Thanks very much for the tutorial, i already moving my mu wordpress.
Nia
betterfasterstranger says
Hey Kristarella,
Thanks for the tutorial, got through it and can view my site on the new server (moving from a localhost to our work network – WPMU is for our intranet), but – I can’t get to the admin panel anymore…
Any ideas?
Cheers!
kristarella says
Don’t know about being unable to view the admin. I guess I would check the database in the options table and see what it thinks the URL for the blog is: in the table wp_1_options (or something other than wp_ if you chose a different database table prefix) check row 1 and row 39 (site URL and home, respectively) and see if they match.
Are you able to get into the dashboard for any of the blogs on the WPMU site? Are you only blocked out of the parent site admin?
Also, if you have plugins installed, perhaps try deleting/moving them out of the plugins folder. If one of them has settings interfering with the new address then you should be able to get in if the plugins aren’t present. Then you can add them back gradually and see how they go.
Ross Bennetts says
How can I do the search and replace on a multi-gigabyte sqldump?
I have access to Mac, Widnows and Linux.
Vi, TextEdit, TexWranlger, Notepad are all choking because the file is too big… I can’t image how phpmyadmin is gonna go trying to import it…
kristarella says
Ross — I’m not really sure. I’ve never tried this on such a large site and wouldn’t guarantee this method for it at all. You could check out the link about BigDump that Mike left before, which might help with the phpMyAdmin import limits.
The reason I downloaded the SQL file and edited it with a text editor is because MySQL seems to want you to search and replace individual tables, not whole databases. I found someone posted a PHP script for going through every table automatically. Obviously make sure everything is copiously backed up before trying such a thing. Here’s another search and replace script, which looks worth investigating.
I use Coda for editing. I don’t know if it will do files that large, but it might. It always displays a message asking if it can turn off text highlighting for files when they get large enough. Other than that it’s been ok with the files I’ve edited, but I doubt they were as large as yours. The free trial is fully functional if you want to try it.
Other editors to investigate:
Hex Fiend
Vim or macvim (I know you said you tried Vi, I’m not sure how they differ, but people seem to recommend Vim across the interwebs for large files)
CRiSP claims to be able to handle up to 8GB files.
betterfasterstranger says
Ah, I fixed it – realised that my wp-config missing the / in
define(‘PATH_CURRENT_SITE’, ‘/’ );
hooray !
Ross Bennets says
TextEdit actually did the trick eventually… it just took over 30 minutes and used 99% of my 4GB RAM… and I figured out how to get to the command line version of mysql on MAMP… I think I’m good now…
I am trying to make a duplicate version of my site so I can do some development work without battling with a poorly configured version of APC…
Thanks very much for your help…
🙂
Holling says
Thanks for the walk-through…worked like a charm, at least once I corrected a mis-spelled domain name.
Cheers – Holling
Kristina says
Does this transition from domain to domain PRESERVE your plugins,, settings for everything,, so on??
kristarella says
Kristina — Yes, as long as you move the plugin files along with your other files all their settings etc should remain in tact.
Kristina says
Awesome! Thank you 🙂
Tela says
I need to move a wpmu site (biovedawellness.com) to a new host. Will this process work for that as well (domain name won’t change)?
kristarella says
Tela — You won’t need steps 3–6 of the tutorial then. If it’s a large site you might need to look into BigDump from the comments above to get the database into the new server’s database — I used it a couple of weeks ago, it worked really well! Other than that you’ll just need to download your whole installation from the original server and upload to the new one. As far as I know that should be it.
Dave Lee says
This was an AMAZING post. I almost blew up my WordPress MU install and several blogs before I found you. Thank you so much for posting this!
saxx143 says
I found your site very informative and I am about to take that journey. But I need to know if I need to. I had a wordpress site on my domain and then decided to do wordpressMU. Instead of exporting or what ever I just created a subdomain and recreated my site there. now i have two sites. Selectivesounds.com and multi.selectivesounds.com
What i want is to make the multi. selective…. into the main domain, Selectivesounds.com. Is it a matter of just redirecting the domain? If so will the address bar show the subfolders as selectivesounds.com or multi.selectivesounds.com?
Hope its not to confusing.
kristarella says
saxx143 — I’m not sure what the best approach for you is. Assuming you are shutting down what is currently on selectivesounds.com and moving the content of multi.selectivesounds.com to it, and assuming they are two different WordPress installs, multi. being WPMU, there are 2 approaches:
Before doing so you should backup and then delete all the content, or do a new WP install at selectivesounds.com
Be sure to consider the impacts of a large database, you might need to use BigDump or Sequel Pro (a mac application) to handle the database instead of phpMyAdmin
If the two blogs are actually part of the same WPMU install then your safest option is to just use the WordPress export to move all the content from one blog to the other.
If you are venturing into a lot of rearranging and site wrangling you should consider that WordPress 3.0 is nearly out — the release candidate is out and is quite stable — and it’s replacing WPMU, so you might want to upgrade your WPMU to WP 3.0 or just create a new WP 3.0 install and import your content to it.
SaXx143 says
Hello,
I thank you so much for your advice.
I was curious now that WP MU 3.0 is out would you change any of what you told me on how to move my wordpress Mu location to another directory. (the question that I asked earlier)
kristarella says
saxx143 — I haven’t been able to dig deep into the workings of WP3.0 with networks enabled yet, but a cursory glance appears that it functions very similarly in terms of databases and site settings. I don’t think my advice would be different.
SaXx143 says
Hello,
I must start with Thank you. It definately worked. Now, I am back with another question that is off topic but I am hoping you can help me. Do you know much about buddy press or those social plugins? I have a WPMU site that I want to act as my main site and I want to have other blogs for various other areas. I would like them to function on their own but I want the social aspect of the blogs to be tied together. As of now I am on the verge of being right but I am still wrong. My sites (right now only two..trying to begin correctly) connect to each other but the second one uses the main sites theme to show activies, members, groups and so on…. would you happen to know what I am doing wrong?
Thanks in advance….
kristarella says
Saxx143 — I have very limited experience with BuddyPress, but what you’re saying about using the main site’s theme makes sense if your theme on the second site is not BuddyPress enabled: it would need the proper template files for displaying members etc. It’s possible if they’re not present then it will use the template files from another site on the same network that does have those files.
Anne says
Thank you! Thank you! It’s always the simple things, like this time the site url in wp-config, that gets me. Many thanks.
Elisa says
Hi there,
I did similar to what you describe in your tutorial. In my case I moved from an apache localhost in my machine to a live server (bluehost). I zipped all my files, ftpd them to bluehost, created a database, imported the database to bluehost from my machine’s localhost, then did a search replace to the new live name (replacing my localhost name with http://www.schoolwhizz.com). The main blog seems to sort of kind of work, I mean I can see the front page (main/primary blog), but all links even though they appear correct in the browser bottom bar (status bar I guess) when clicked produce a 404 not found. Same for all blogs in the MU install, they are all 404s even though the data is in the database and the path seems correct. Any idea what’s going on?
kristarella says
Elisa — It sounds permalink/htaccess related. Check your .htaccess file and see if anything looks askew.
Elisa says
Nevermind. I learned you had to do some sort of .htaccess trickery to fix this. I didn’t have an original .htaccess so I had to create one. The relevant changes can be found here in case anyone is interested (look down in the article where it says “modify your .htaccess file”: http://developersmind.com/2010.....press-3-0/
Elisa says
Thx Kristarella! Found that out. Since I didn’t have an original .htaccess file I didn’t know I needed one or what to do with it even if I had one, but the article cleared it up. Thanks for the hints in your article! All other steps worked flawlessly! 🙂
David Alexander says
Good tutorial, unfortunately I thought it may have mentioned moving a mu site within a domain, or duplicating the content and all settings to another mu site on the back, so you could quickly make 5 that had identical content and style them in 5 different ways after to compare. Any ideas? I tried a few MU plugins but they didnt really play nicely. Thanks in advance.
kristarella says
David — I’m pretty sure that the process is the same for moving WP multisite within a domain: you still need to edit the database etc if you’re moving the whole setup.
I haven’t figured out yet how to quickly duplicate a single site within a multisite install. I’d love to be able to set up a site that acts as a template for other sites, but the closest I’ve come is using the export/import for posts and pages, but it doesn’t copy the settings.
David says
only just realized you commented here to that point. Yeah same here. I found a few plugins that were interesting but didnt 100% work, have you tried any? They were:
Add Cloned Sites for WPMU (batch)
and
Default Blog
Yeah it would be pretty good. especially in my current test scenario where I want to use MU to create 5 sites with identical content and pages (for now) and have a different design/layout for each as examples of what can be done with the same info. Still no wordpress settings and options export plugins we know of? Im surprised by that.
kristarella says
David — I don’t know of any *effective* duplicating or exporting plugins, but I haven’t looked for a while.
I’d be inclined to try more of a theme switcher than creating whole new sites for what you’re describing.
David says
Yeah, those two plugins seemed to almost get there but there’s something missing.
I have done theme switching but using a javascript to load the different css on the single install. You can see this at http://esteightyfive.com an experiment I was playing with. I can send you over the files from that if your interested.
Ruben says
Is it still that same way to change a Domain in WordPress 3.3.2 with a WPMS Installation?
Would be interessting, because i just hang on it and dont find the place where to change the Domain name!!!
Thanx a lot
kristarella says
Ruben — Yes, I haven’t tried to move a new WP network, but as far as I can see it should be the same.