So…I’ve had a several requests on how to move a WordPress installation to a new server, so I decided to make a post about it and show you how to do it. This is going to be a lengthy post, but if you will follow the directions you will have no issues moving your site.
First off, there are many methods on how to do this, but the one I will walk you through is how I do it and it works for me, so here goes.
The first thing you will want to do is log into your existing server via FTP and locate your WordPress installation. There you will locate the “wp-content” directory and back it up to your local machine (PC/Mac, whatever)…just download it to your machine so that you have it for later.
After you have done that, then you will want to log into your SQL database. You can do this through your hosting control panel (CPanel, etc). Once in your database, you will want to export it. Locate the “Export” button for your database…it should look like this: (note: your database might not look exactly like this as I have other tables in place)
After you click “Export” you will see a screen that looks similar to this:
Make sure to “Select All” and that you have “SQL” selected as the export type. Then to the right, you want to check the boxes that say “Add Drop Table” and “Add If Not Exists”. What that does is make it so that if the tables already exist on your new server, it will overwrite them when you import your existing database there. We actually won’t do that with this demonstration, but it’s always a good idea to do so, just in case. After that, you will check the box toward the bottom that says “Save as File” and then click the “Go” button in bottom right. This will produce a download and you need to save that to your machine as well.
So at this point, we have our “wp-content” folder and the database backed up. That is everything you need from your existing site.
Next, you will go to your new server and set up a completely new WordPress installation. Once you have done that, log into the new site via FTP and locate the WordPress installation and find the “wp-content” directory for the new installation. You can do a copy/replace here, but what I always do, just to be safe is to delete that directory completely and then upload the one that you backed up earlier. So to recap here…delete the “wp-content” directory on new installation. Then upload the “wp-content” directory that you backed up earlier into the new WordPress installation.
Once you have done that, then you will want to log into the database for the new WordPress installation. When you get there you will want to check ALL of the existing tables and then choose to “Drop” them (there should be 10 tables on a default installation). That screen should look something like this:
After selecting “Drop” you will be prompted with a screen that looks like this:
You will select “Yes” to this action and all of the database tables will be deleted.
Next, you will want to import your database that you backed up earlier. So you will find the “Import” button up top:
After doing that, you will be prompted to “Browse” and find the SQL file you want to import. So click “Browse” and find the SQL file that you saved from your old site earlier. Click “Go” and that will import your database.
After the database has been imported, you will see all of the tables that were on your old site in the left column. What we want to do now is tell the database where your new site is located (the URL), otherwise the site will not work. So in the left column, you will want to click on “wp_options”.
After clicking on “wp_options” you will see the fields associated with that table. You will want to click on “Browse” in the top menu bar.
After clicking “Browse” in the top menu area, you will then see all of the keys that are associated. The first one is called “siteurl”. You will want to edit that key to enter your new URL. So you should see a pencil icon to the left like this:
Click the pencil icon to edit that key and it is there that you will put in the new URL for your new site. After you have done that, click “Go” at the bottom of the screen to save that action.
That will tell the database that your site has a new URL from what it did when you backed it up. Once back on the screen for “wp_options” if you will go to Page 2, you will see another key for “home”. Do the same thing for it. Edit it and replace the URL there as well with the URL for your new site. Click “Go” to save it.
Last but not least, you will want to look for the “upload path” field in the “wp_options” table as well. It’s usually on Page 2, but will look like this:
Click the pencil icon to edit, and make sure that the value in there is set to “wp-content/uploads”. Sometimes after the move, this will have a string of data pointing back to your old server and this can mess up all kinds of things like media uploads, plugins, etc. So you should have it set to look like this:
After you do that, click “Go” in bottom right to save your changes and you’re all done!
You can now navigate to your new site’s admin area, login and make sure that the correct theme is selected and all plugins are active.
After that, you’re ready to go….your WordPress installation has been moved to a new server and you don’t have to jump off of a bridge, because it wasn’t that hard at all!
So, until next time…
Brian says
Nice writeup. Thanks Shayne.
There are a couple of extra steps I usually take.
* Disable plugins on original site (then enable on new site when done). This may not be necessary, but I want to make sure that if there is a problem with the move, it's not one of my plugins that's causing the problem.
* Don't forget to update your feedburner account to point to the new feed address.
* If you are using wp-ecommerce, go into the 'Admin' tab and change the URLs at the bottom. (At least this applies to 3.6.12, not sure about 3.7).
* After the move, go ahead and hit the 'search' tab while you're looking at the MySQL database. Search for references to your old domain name. If you find any, you'll want to change them.
shayne says
Sure Brian…
And yeah, everyone does it different…thanks for the extras…will help someone I'm sure.
Miguel Netto says
Thanks shayne, but some plugins store the real url in the database. I m talking, by example, the plugin WordPress Download Monitor (http://wordpress.org/extend/plugins/download-monitor/). In the first versions he store like /wp-content/uploads/ and in the last versions http:///wp-content/uploads///.
This is not my language and I dont understand nothing about MySQL but I read something about commands in MySQL in http://www.korben.info/changer-le-nom-de-domaine-….
shayne says
Miguel,
Yeah, this tutorial was for mainly WordPress. Some plugins can act the way you have described, but that is on an individual basis with each plugin.
Brett says
Shayne,
This helped a ton. Thanks. I got my own GoDaddy Hosting and needed to get my site of my friends server. These instructions were perfect once I read each line! My first go around, I tried to put it all in a folder /blog/ but then nothing worked. I erased everything and started over just putting everything in the main directory. Following your instructions worked.
I wish I knew (for next time) how to move everything to a different folder so I don't have to see all of the WP stuff cluttering my main folder. Also, since I was using WP 2.7, GoDaddy made me upgrade to 2.8 and I got the WP white screen of death. So, I had to Google how to fix that, all to find it was my SEO Plugin that needed to be uninstalled, then reinstalled.
Thanks for your post, it saved my site! :o)
shayne says
Brett,
Glad it helped you out.
As for moving everything into a different folder, just move all WordPress files and directories to whatever folder you want, then go into your database and change the URL to reflect that change…just like I mention in this tutorial, but it would be like this:
http://www.yoursite.com/newfolder
Hope that helps.
Angela says
Hi Shayne, I just moved my site to a new server and had a problem with the pictures, so I am loading them up again; however, one thing that is happening is, when I click on "all products", the first page shows; but if I try to click on page 2 or 3, then I get "Error 404". Is there a way to fix this??? ๐ Hope you can help point me in the right direction!
Thank you!
shayne says
Angela,
You might try going to "Products–>Settings–>Admin" and clicking the "Fix Product Group Links"
Tom Hermans says
Nice tutorial. I'd like to mention that just like WPEC-plugin, the cforms-plugin doesn't handle a migration very well too. Keep that in mind before transferring to a new server.
Tom.
Nick Armstrong says
Just curious ->
Why don't you use the Export/Import feature in the Tools Menu in WordPress? You get an XML file, then you can grab your wp-content/uploads folder and you're done. This is the method I always use, so I'm more curious if I'M missing anything doing it this way ๐
It doesn't retain widgets or special theme-type stuff (footer code for Thematic, for example).
-Nick Armstrong
shayne says
Nick – You can do that…but that way doesn't keep WordPress settings and plugin settings in place.
jeff says
Hey there Shayne. So my new domain points to new folder under my big domain… I just changed the folder name of my old wordpress site to the new folder name (so my new url points to it…. I didn't move anything… Afterwards i just ran a URL correcter plug in. and changed the site URL under general settings
Everything seems to work, Did I do something wrong that I will regret down the road? Thanks.
spencer says
Shayne, great tutorial. Life saver – so much better than the codex version.
Thanks for taking the time.
shayne says
Jeff – I don't think you should have any issues…the tutorial was talking about a more involved "move"…what you did should be fine.
Jason says
Hey Shayne,
I'm having problems with slimstat-ex and some other plugins not working after my hosting company moved my site to another server. Any ideas on how to remedy this?
shayne says
Jason –
I would try deactivating and reactivating the plugins. If that does not work, you could always remove them and then load them again…
tamsin says
Thank you from here to eternity. I will get to understanding sql sometime, but until i found your blog i would not have figured out how to go live with my wp local installation. Awesome and clear. Should i change the url for the recently_editied which still refers back to my local server? As such a:4:{i:0;s:66:"C:wampwwwwordpress-2.4.8/wp-content/plugins/akismet/akismet.php";i:1;s:28:"/themes/suffusion/custom.css";i:2;s:94:"C:wampwwwwordpress-2.4.8/wp-content/plugins/subscribe-to-comments/subscribe-to-comments.php";i:4;s:0:"";} I tried to remove url up to wp-content in both instances above but this seemed not to go down too well, have left it. Any advise would be great, but my site is up and live and seems functional.
Thanks again
Anja says
I usually use the import/export feature of WordPress, but this time I have a WP Ecommerce site which doesn't work with import/export. So I followed your steps to the "T". But when I go to test the site only the home page works. All links give a 404 error (Page not Found). Everything looks well in the backend (all pages are present) and the database looks complete. However, changing only the two URL's doesn't seem to be enough to make a site work.
My client is currently without a site because I cannot make it work. HELP!!!!!
Site: http://futureprospectsbaseball.com/
Anja says
I found out what caused the error. In Settings > General Settings the URL didn't have the www included.
But now I discovered that my shopping cart doesn't really work. All is there and looks as expected but I can only add one product but it doesn't get added to the checkout screen. I have looked up and down the database to find out what else needs to be changed. Anybody has experience with moving sites that use WP E-commerce?
shayne says
Anja –
I move sites with WP ECommerce all of the time, so the above steps should work just fine.
If you're having issues with the items not showing up on the checkout page after being added to the cart, that is most likely an issue with "sessions" on your new server. And it makes sense that it's happening (where it didn't before) because of your new server.
I would contact your host and make sure that sessions are enabled and configured properly as that is most likely the reason for the issue you're experiencing.
Hope that helps.
Alan says
Thanks for this. It's perfect. I've stumbled about and done it myself moving my wordpress site from a local install on my laptop to a server. I used the wordpress export import xml files but got the saved version wrong. Which means the two sites ended up out of sync. I ended up with an earlier incomplete version on the server and couldn't figure out how to overwrite the earlier wrong entries in the database.
This article has given me what I've been missing. I can now delete the previous tables and replace them with the new. Knowledge I did not have before. I've moved a static site to a database driven site. You can see it in progress at http://www.stooryduster/stoory_wordpress/until it is workin then it will be moved to the root.
Thanks.
Cheers
Arto says
Hi and thanks for this great howto.
I use it a lot but always encounter one problem: I get my character encoding (UTF-8) mixed up. I have done this on several servers and it's usually moving from a server in the US to a server in Switzerland. Before the WordPress installation was set to UTF-8 and later too, but characters like öäü get messy. Then I can change to ISO-8859-1 but then some plugins (e.g. messages in CForm II) have trouble with some characters… Also character (öäü) that are hardcoded in the theme (without using ü etc.) have trouble. Any ideas how to solve this when transferring a site?
Thanks,
Arto
Rohit says
Hi Syane,
Thanks for a clear step by step guide. I seem to have got stuck on the final step and need help. When I try to import the tables from the downloaded database, I get the following error message:-
Error
SQL query:
—
— Database: `information_schema`
—
CREATE DATABASE `information_schema` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
MySQL said: Documentation
#1044 – Access denied for user 'sword_arm'@'localhost' to database 'information_schema'
Please help.
Rohit
shayne says
Rohit –
That is something that you should probably talk to your host about…it's either your database is setup incorectly, or you're using the wrong username/password…either way, that's something for your hosting company.
eric says
I followed the instructions on your guide which was really easy and helpful but for some reason i am getting this error… i had this error before and all i had to do was run a "fix" from the old hosting company and it fixed the pages and links for me but now i migrated my new host don't have a fix, they did check the integrity of the database i uploaded and they say its not a problem on that… so am not sure why i am getting this string error
Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at /home/content/p/i/n/pinoypinay/html/wp-content/plugins/wp-e-commerce/wpsc-includes/upgrades.php:270) in /home/content/p/i/n/pinoypinay/html/wp-content/plugins/wp-e-commerce/merchants/paypal_certified.php on line 752
Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/content/p/i/n/pinoypinay/html/wp-content/plugins/wp-e-commerce/wpsc-includes/upgrades.php:270) in /home/content/p/i/n/pinoypinay/html/wp-content/plugins/wp-e-commerce/merchants/paypal_certified.php on line 752
shayne says
Eric –
Not really 100% sure on that….have you tried deactivating and reactivating the plugin after the move? Also, you might try doing that to other plugins on the site to see if they might be causing issues.
eric says
hey thanks for the response the first time i saw it, it knida gave me a hint its a plug in issue.. tried it again still no go…. any suggestions?
Brian says
Is there a way to copy only the products, categories, & variations to another site? I'm splitting up my products into 2 sites and it would be much easier to copy these as opposed to starting from scratch. The 2 sites use different templates so I can't do a complete copy. Thanks.
eric says
kinda played around with it… and i think whats causing this is the wp eCommerce plugin… i installed a fresh one and after that i installed the wp e commerce and then the error poped up… Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/content/p/i/n/pinoypinay/html/wp-content/plugins/wp-e-commerce/wpsc-includes/upgrades.php:270) in /home/content/p/i/n/pinoypinay/html/wp-content/plugins/wp-e-commerce/merchants/paypal_certified.php on line 752 as you can see the link error leads to the plug in merchant folder for paypal… tried to look into the codes but still no luck.. any suggestions?
ERIC says
thanks for all the help i kinda figure out wehat the problem was… i disabled all plug ins but i left the wp ecommerce active and making it still active plug in cause this error make sure its all disabled before copying to your pc… ugh should have benn more attentive… thanks so much shayne… happy holidays dude
WPExplorer says
This is always a scary process and can be quite difficult for WordPress novices. You did a good job with this tutorial. Kudos.
karen says
Hey, thanks so much, you sent me the link to these instructions from Linkedin. I followed your instructions but when I tried to import the database I got the following error message:
Error
SQL query:
— Database: `buneekb_wrdp1`
CREATE DATABASE `buneekb_wrdp1` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
MySQL said:
#1044 – Access denied for user 'clickher'@'localhost' to database 'buneekb_wrdp1'
Any idea what i am doing wrong. ? My original test site was at b-uneek.net, and i was trying to learn how to transfer a WP site by bringing it over to clickhereforworldpeace.com.
If you have any ideas I'd be really grateful.
thanks again,
Karen
Kilwag says
I used this method to move wordpress installs a few times but the last time it wouldn't work. Basically it was an known issue with PHPMyadmin, it doesn't always work once the database gets larger than a certain size…(don't ask e what size) I even tried exporting tables individually, but the larger ones wouldn't work. It would just time out eventually. I ended up having to do the database dump via ssh in the terminal, looked it up on Google, it ended up being super quick. I used it on the site that is linked in my name. It had about 2,500 posts and 20,000 comments at the time.
Enter Your Name... says
I actually moved it from a standard WordPress install to a MU install. I was going to write up a guide on how to do that, but fortunately WordPress 3.0 will eliminate that need!
shayne says
Karen,
That could be a number of things. I would contact your host and give them that error and let them help you with that.