If you do it incorrectly, you stand to lose all your widget settings, some file links and so on. This wasn’t a problem with ‘classic WP’ years ago, but these days there are many many paths stored away in the database, in various forms, and catching them all can be somewhat tricky.
Here I show you the steps we take moving a localhost site to a live domain. We’re using WPMU which is running the BuddyPress plugin suite.
The Local Install
Copying the Files
So – select and drag all the files from one side, to the other.
Moving the Database
- Click Backup
- Create New Project
- Select the Schema you’ve been using
- Click to move it across, selecting ALL tables (unless you have multiple installs in one database, in which case, just the tables for the install you’re interested in)
- Give it a name
- Save Project
- Execute the Backup
Because the server we’re using doesn’t allow connections on Port 3306, we’re going to use phpMyAdmin there. This is no problem at all, but if you were using mySQL administrator you could use the restore tools there. If you’re doing this kind of project you should really know how to use these tools anyway – I’m only explaining these steps for completeness sake and showing you a migration I’m doing myself that’s likely to be typical.
Editing the SQL
Be very careful with this database dump by the way – database dumps are a very easy way for hackers to get into your system and find out lots of information you’d rather not give away.
Importing The Database
- Click on the Import tab
- Select your file (if it’s bigger than your sever’s upload limit then you’ll have to speak to your admin guys about how to do this.
- Press the Go button!
Visit the Site
You need to change the wp-config.php file.
Changing wp-config.php DB Settings
Change 4 to the appropriate path. Most installs are in the root directory, so that would mean $base = ‘/’;
Change 5 to the domain name in use.
Change 6 from ‘/buddypress.11/’ (or whatever your local path is) to the new path, like in 4, so in most cases that will be ‘/’ also.
Search & Replace on the Database
I can’t emphasise enough that it’s important to handle serialised PHP correctly. If you don’t, then settings will go missing, fields will get corrupted, and your site runs a severe chance of not working on the new location. It’s a pain, but it’s important.
So, download the program, place it in your blog’s root folder and then run it by visiting the appropriate URL.
If you’re getting confused at this point, perhaps you shouldn’t run the program. Just saying, because it can cause plenty of damage!
Running the Script
You may have to modify .htaccess to fix paths, and you may need to check your uploads folder for media. But that’s it. All should be good.
Extra Steps for WordPress MU
But in this example, we’re running BuddyPress on WordPress MU, and that means one extra step. In phpMyAdmin you need to open up (1) wp_blogs, (2) click the browse tab, and (3) click the edit tab for each row. If you have a lot, you may wish to run another searchreplacedb.php against the database, looking for localhost.localdomain and buddypress.11 and swapping them appropriately.