1 year ago
Moving WordPress to a new server
For awhile now, WordPress has been my favorite option for providing clients with a Content Management System. And since the release WordPress 3, it’s become the easiest sale on the planet. After showing them a demonstration, 75% of the time, the client loves it, and it persuades them to pay double the price they would have paid for a generic ol’ static website. It’s amazing how much WordPress 3’s menu builder has had such an impact on the entire software and the overall presentation of it.
So, needless to say, I’ve been churning out a lot of WordPress sites recently at the agency. In this post, I’m going to talk about that last step you take in delivering your shiny, new WordPress site to your client filled with all of their content.
Generally, you’re not going to build the website on your client’s live domain. I usually develop the initial WordPress theme and put in whatever parts of the content I have at the start of the project locally on my computer using MAMP. Then I’ll transfer that site to a dev server where the client and everyone else my agency can view it. After a billion rounds of edits and changes, it’s finally ready to go live, and so then it’s transferred to the client’s live domain.
In creating all of these sites, it’s absolutely crucial to be transferring WordPress correctly. Your concern should be developing your client’s website and not struggling with elementary things like installing and moving around WordPress. If you’re new to the process of moving WordPress, don’t worry. I’m going to explain in it detail. I also would suggest that you practice moving WordPress a few times to different servers. After a few times, you’ll get the hang of it, and see how easy it is. If the first time you’ve ever moved WordPress is the time when you’re putting you client’s site live, you are putting yourself at some serious risk for embarrassment.
Keep in mind that if you’re simply moving your personal WordPress site a new server, all of the following steps are the same.
The Quick Version
To start with, here is a quick version of the process of moving your WordPress site from one to server to another. Even after you’re familiar with the process, it’s not a bad idea to have a checklist of all the steps you need to take sitting by your desk.

If all of those steps weren’t clear, don’t worry; I’m going to explain each one. In the following steps, I’m going to show some screenshots from when I transferred the demo site for my Complexity WordPress theme from my local computer to my live demo website.
The Long Version
Step 1: Export a copy of your dev site’s MySQL database as an SQL file.
The first thing I do is make a copy of the dev site’s database. Login to phpMyAdmin on your development server and export a copy of database.
When you do this, make sure you are actually within the database. You should see all of the tables of your WordPress installation as the screenshot below shows. Then, click “Export.”

Next, configure your export file as I have in the screenshot below. Make sure you have all tables of your database highlighted on the left side. Also, make sure you have the “save as file” checked at the bottom. Click “Go” and a copy of your database should be saved to your computer as an SQL file.

Step 2: Open this SQL file in a text editor and do a mass find and replace of your dev site URL with the new server’s URL.
Open up the SQL copy of your dev site’s database you exported in the last step in a decent text editor like Dreamweaver, Coda, Textmate, Netbeans, etc. Avoid using a default text editor that comes with your computer (like Notepad with Windows, for example). With large files, sometimes screwy things can happen.
Do a mass find and replace of your dev site’s URL with your new server’s URL.
This is a very important step. If you do this properly, all of your hyperlinks throughout your entire WordPress site will linked up properly on the new server (i.e. manual links you put to other pages in your content, links to images you’ve uploaded, custom links you’ve used in the menu builder, etc.)
I personally use Coda for Mac OSX for all my coding, and below is an example of how to do a mass find and replace with your database SQL file in Coda.

I know Dreamweaver is much more popular, and so here is a screenshot of doing the exact same thing in Dreamweaver.

Step 3: Make a copy of your dev site’s files so they’re ready to upload to the new server.
I personally feel it’s a good idea to actually make a copy of the files of your dev site because if you screw something up, it’s nice to know you have a fully functional dev site still sitting somewhere. So, make a copy of all files, meaning your entire installation of WordPress.
If you have your website locally because you’re using MAMP or WAMP, make a copy of the files. If you have your dev site on a live web server, download all the files to your local computer.
Important Note: Confirm everything in your wp-content directory gets copied. This directory contains everything crucial in the actual configuration of your WordPress site – Themes, Plugins, and Uploads.

Step 4: Create a MySQL database on your new server.
If you’ve created your dev site, I’m going to assume you know how to create a MySQL database. So find where your new server’s database management is (usually in cPanel or whatever similar software your web hosts uses) and create a new, empty database and assign a new username and password to it.
Step 5: Configure your dev site copy’s wp-config.php file with the new server’s database information.
Within the copy you made of your dev site’s files, open up the wp-config.php file and put in all the information from the database you created in the previous step on your new server – database name, database username, database password, and database host.

This is the typical process of installing a WordPress theme, which I’m sure you’re already familiar with. However, it’s a good idea to have your wp-config.php file all ready to go before you upload your files so you can minimize the amount of downtime on the new, live server before the site is actually running.
Step 6: Upload the dev site files to the new server.
Now that you have a copy of all your files, you’ve made sure everything in your wp-content directory is there, and you’ve configured your wp-config.php file, you’re ready to upload!
So, use an FTP client and upload all of your files.

Simply uploading all of your files via FTP is the most common way of doing this process, and it’s perfectly fine to do it that way. However, I do have a tip if you want to be a little more efficient.
Archive all of your files into a ZIP package and then upload that ZIP file to your new server. Most hosting accounts have an interface like cPanel with some kind of File Manager interface, which you can log into and then extract the ZIP package. And if you’re a little more saavy, you can shell in with an SSH client, and unzip that package really quickly.
There are a few of reasons why it’s a good idea to ZIP the files first before you upload the files. When transferring a WordPress site that has been fully developed, chances are you have a lot of files (i.e. your plugins, uploads, themes, etc). These files will take a while to upload and it’s much faster to upload an archived ZIP package.
Other than just the files taking forever to upload, another issue arises sometimes when uploading a lot of files at once through an FTP program. Often, your upload will time out or there will be a temporary connection loss to your server, or something breaks the upload for whatever reason in the middle of the uploading process. When you’re dealing with your client’s new, live site, you don’t want to be wondering if you’ve missed any files. By uploading a ZIP package you can be a lot more certain that you’ve gotten everything successfully to the new server on the upload.
Also, if you are uploading the files one at a time to your new server and someone happens to visit the live URL, they’re going to be presented with funky error messages because WordPress is only half there. This is actually more for the benefit of your client. Clients are always excited about their new website and will keep checking the live domain like an eager schoolboy on Christmas morning, waiting for it to be up. When they see some PHP error, they are going to freak out and call you. You’re going to have to then explain to them that you’re still in the process of uploading files and working on the site.
Step 7: Make your uploads directory writeable (permissions 777).
If you want your client to be able to upload images and files via the WordPress admin panel, make sure you remember to make the uploads directory writeable (permissions 777) on the new server.
You can go in do this with any FTP client.

Step 8: Confirm your database is linked up correctly by going to the new site and seeing the Install WordPress screen.
Now that all of your files are uploaded and in place, it’s a good idea to make sure the files are there and that your wp-config.php is connected properly to your new database. So, if you visit the URL of the new site, you should be forwarded to WordPress Installation screen because your new server’s MySQL database is still empty.

If you’ve inserted something incorrectly in your wp-config.php file or the new server’s MySQL database was not setup properly, you’ll know because you’ll see WordPress’s database connection error.

Step 9: Import your dev site’s SQL into your new server’s database.
Now you’re going to need that SQL file you created back in steps one and two.
Login to the new server’s phpMyAdmin and navigate to the database you’re using. If you’re unsure how to do this on the new server, make sure to contact the web host’s customer support and ask.
Click the Import tab. Then, select the SQL file from your computer and click “Go” to import the data.

You should see a message that lets you know your query was successful, and you should see that your database is now populated with all of WordPress’s content.

Now if you go back to the new, live site, you shouldn’t be forwarded to the WordPress installation page. You should see your website!
Step 10: Login into the WP admin of the new site and go to Settings > Permalinks and click “Save Changes” so an .htaccess file with permalink structure is created on the new server.
At this point you should be just about finished. If you had permalinks setup on your dev site, and you start clicking around the new, live site, you might initially notice that none of your pages are showing up when navigating away from the homepage. What the hell? Don’t fear! There’s a simple answer.
Basically, your WordPress database is configured with the correct permalink structure, however the needed .htaccess file that gets created back when you setup your permalink structure on your dev site isn’t there anymore on the new server. So WordPress is trying to navigate to the correct links, however, your server isn’t setup to handle them yet.
The fix is easy. Login in to your WordPress admin panel and navigate to Settings > Permalinks and simply click “Save Changes” so WordPress can create a new .htaccess file on your new server.

With some web hosts, WordPress will give you an error message when you try and save your permalink settings, telling you that it couldn’t create an .htaccess file. This just means that you need to go into your web host’s file manager and create a new file, name it “.htaccess” and then make it writeable (permissions 777).


56 comments
This is the coolest blog ever. Please keep posting stuff. And maybe i’ll buy you a coffee… or can of tuna.
Great right up dude! This was exactly what I was looking for! Doing some local development with a live site so I am taking a copy from the net and installing it onto my local/mamp server! Super helpful thanks
good share, great article, very usefull for us…thanks!
Awesome post, I’ve transferred wordpress blogs from a dev environment to a production environment a few times and thought I had it nailed, but you saved me a few steps! Mainly in dealing with the .htaccess stuff.
Thank you very much, you save my life. After 4 hours trying using WordPress Database Backup and having so many problems, i tested your way and voila!!!
@ I have just added this post to buzz.com
how are you!This was a really exceptional blog!
I come from itlay, I was fortunate to discover your topic in wordpress
Also I obtain much in your blog really thanks very much i will come daily
This is a helpful suggestion..
Thanks for a very well written guide.
I have a problem with a wp site a friend wants me to work on. She has exported her DB and sent me all her wp files (she started work on her own localhost) .
I have created a new db on my localhost (mamp) and have changed the settings in wp.config. but I get a Database error connection.
What am I doing wrong?
Many thanks
@nathan That actually probably has nothing to do with transferring the database. It just means you didn’t connect to your DB properly in wp-config.php. When you’re using MAMP, you need to make sure put in root for the username and password for the DB (unless you set it up otherwise).
Pretty impressive article. I just came across your site and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be coming back and I hope you post again soon.
I enjoyed reading this blog post! Keep up the great work.
thanxx
My dad has been writing a book precisely on point with this blog, I have emailed him the web address so perhaps he could pick up a couple pointers. Fantastic Job.
thanxx
how are you I was fortunate to discover your topic in yahoo
your topic is impressive
I get much in your subject really thanks very much
btw the theme of you website is really wonderful
where can find it
Nice post, thanks for sharing
keep up the good work
Hi there
Just wanted to show my appreciation for your time and hard work
Ah!!! at last I identified what I was looking for. Somtimes it takes so much effort to discover even tiny helpful piece of information.
Good day I was luck to seek your topic in wordpress
your Topics is fine
I get much in your topic really thanks very much
btw the theme of you site is really splendid
where can find it
Hi,
I followed every step of your great description in order to get a local version of my live website. I use OsX and Mamp.
At the end, when I type http://localhost:8888 , my (local) website appears, thus so far so good.
However, whenever I try to login into the WP admin, I don’t succeed. The only thing I get is an empty page.
Any ideas?
Thank you, thank you, thank you! I had done everything correctly, but that last step–creation of a new .htaccess file–was causing all the links to be broken. I read your post and five minutes later had everything working great. Thanks for the help!
Jason,
Everything worked as planned except for the last step. None of my images came up, just the place holders. Tried creating an .htaccess file and changed permissions and updated my permalinks but still no go- any ideas? I can upload and replace but I have a ton of images.
thanks for the help, turns out ive purchased your alyeska theme in the past… plenty of help for that too.. well done
Hey Jason,
Nice post! By the way I’m a huge fan of your Alyeska theme, using it on my site and I love it!!
So I used to perform these same steps all the time myself, in fact I have a checklist similar to this one. However I started moving so many sites that I created a plugin to help me automate the moves.
You can check it out here:
lifeinthegrid.com/duplicator
It’s still in Beta but I have been able to move sites from Windows to Linux and Linux to Windows and Mac with quite a bit of success!
Hope all is well and keep cranking out your awesome themes!!!
That’s pretty cool. I’ll be looking into this topic a bit more in the near future, as I’m trying to create a solid system where I can export my theme demo, and give my theme buyers some sort of way to do a quick simple install of my demo site when they purchase a theme.
This was the clearest explanation of moving WP I’ve found. I’ve been migrating several sites from Movable Type and into WordPress offline on MAMP, and after all that headache, by the time I get to this point I want it to be easy–and it really is! Thanks!
This is great – the most comprehensive walkthrough of the process I have found (and I’ve spent a couple of days searching). One crucial step that many others miss is the updating the permalinks in the wp-admin panel.
Nice one, Jason
Here’s a tip to avoid frustration: Be totally sure your WP database prefix is exactly right. If it is off by as much as one character, WordPress will continually think you want to start fresh.
Thanks for this. Second time you’ve saved my butt!
[...] Moving WordPress to a new server [...]
Hey Jason,
Love your post man…everything ran smoothly until I tried to load the site. instead of going to the normal http://localhost:8888/wordpress directory that I created it goes to a http://localhost/wordpress and can not find the connection? would this be a database issue or am I not configuring the wp-config.php file correctly? Thanks for the help!
Sam Keyes
Is it possible somewhere along the line you messed up your site url setting?
This is controlled in your WordPress admin panel here: Settings > General.
However, obviously if you’ve messed this setting up, you probably can’t even access that page to fix the setting. Luckily WordPress has built-in a trick to troubleshoot this. As explained here, you can actually define a constant in your wp-config.php that will override your database’s setting in order for you to access your WordPress site and troubleshoot.
So, paste this in somewhere in your wp-config.php and then try to get to your admin panel and change that setting so it is correct. After you’ve done that remove the code from your wp-config.php
define(‘WP_HOME’,’http://localhost:8888/wordpress‘);
define(‘WP_SITEURL’,’http://localhost:8888/wordpress‘);
Hi, I am just curious but how long should a project like this take in hours?
I did a job for a firm locally and all I needed to do was transfer a wp site from one server to a different server. Their site is not fancy just a set of static webpages.
Initially I thought I would just do a fresh install on the new server and import the sql file taken from the export function of the old wp and tweak a couple of the configuration files.
I soon ran into permission issues and opt out to do a back door approach.
I had to do a download and reupload of their wp files from the old server after setting up a new database in the new server and making several backups.
Yeah before I take too long, and I am sure you’re getting my picture. How long should this type of project take?
Thanks for your help, and the tech know-how you’ve presented in this article.
OMG!!!
Jason, thank you so much for the tutorial…I’ve followed your instructions to the T, but something is wrong. To add insult to injury, yours is the fourth method I’ve tried AND I also tried BackupBuddy to move from WAMP to live…
I started a theme from scratch…but it works perfectly locally. In your method I got to Step 8 (confirm link to db by going to your site online) and got nothing. The page is just blank–absolutely nothing.
Any ideas?
With Backup Buddy & other methods, I go to check the site out and the jQuery scripts are going haywire…or that AND I’m seeing my 404 page. In either of these two scenarios I can’t get to my dashboard and all links go blank.
I’ve been at this for two full days…can you help me?
Sincerely grateful!!!
The only real explanation for that I can think of is that either you’re not uploading all the files (or maybe there’s something wonky with your WordPress files). Or the other thing that might result in that would be if the database you’ve put in your wp-config.php for this new site isn’t empty.
Have you tried just installing WordPress by itself from scratch on this new server? Are you able to get through that process? Meaning you download the files from wordpress.org, upload them with your FTP program, and then put in the database info in wp-config.php?
If you’re able to do this with that database you’re using then most likely there’s something wonky with the WordPress files over on your WAMP site.
If you can just get WordPress installed on this new site, from there, all you really need to do is upload all the files in your WAMP site from the wp-content directory and then wipe your server’s database again and replace with sql copy of your WAMP db.
Jason – thank you so much for you reply…I’ll let you know how that goes.
I think it’s my database–how might I begin to fix that problem? Could you point me in the right direction?
If you’re having an issue with your database and you can’t even install WordPress I don’t know what else you can do other than contact your web host.
Hi Jason, great blog post and all was going well until i got to uploading the SQL file to the phpMyAdmin.
Im looking at moving my wordpress site from MAMP to my 1and1 account. And i am constantly being presented with the below error message:
MySQL said:
#2006 – MySQL server has gone away
Can you advise on what i may of done wrong in the process.
Many Thanks
Neal
Hi Neal,
I’ve honestly never heard that one before, but I googled the error message and it looks like there’s lots of hits; so I guess you’re not the only one. But I’d just contact your web hosting company’s customer support and ask them. That seems like a strange one.
For those of us who aren’t very technical, I found a completely free wordpress plugin that automates this entire process: http://www.movewordpress.com/
Thanks for sharing, Chris.
It’s nice that there are plugins out there that do things like this. But really if you’re going to be managing a website I think it’s really important to understand the basic process of moving WordPress that’s outlined in this article. I talk to a lot of buyers in customer support over on ThemeForest and so many are just in way over their heads trying to manage these sites and then when one thing goes wrong, they just are completely clueless on troubleshooting anything, and this can get you into a lot of trouble.
I understand that at first glance this article can be pretty daunting, but it’s not as challenging as it looks. And once you put in the few hours one time here to understand what’s being talked about, you’ll be so much better off, and this process will be quick 10 minute thing each time you do it in the future.
Hi Jason thanks very much for your reply, i shall get in touch with them and if i get the answer i will be back.
Neal
Hi Jason,
I’m moving a wordpress . com site to a server for a very poor non profit org. Our host is practically giving us the server space, and I really can’t question him much because he “does not have time to teach me.” He will charge us if he has to move the site, and they don’t have money to pay anyone.
Needless to say I’m a total newbee at this. I’ve been managing a few wordpress sites from the admin panel only. This is the first time I will actually have to move one. I usually can figure things out, but I’m a freaking out right now. Thank you for this tutorial. I’ve never used mysql. I’m mostly clueless when it comes to Php. Acutally, the only thing I’m familiar with is old html. I wrote my first website in notepad years ago. So does this make me qualified… not!
I’m doing all this work as a volunteer. But, hopefully I will learn from this. I just don’t want to break the site. God help me! I’m so scared to do this move.
Thank you for this post. Wish me luck, and wisdom to understand.
Can I do this using a windows based computer? You mention “MAMP” which requires a Mac operating system. I don’t own a mac. Do I need to use “MAMP” to move our site? I’m confused.
I moved a site yesterday, and when I logged into Users, there was my username Admin from my server along with my email address, and also the client’s username. So I deleted Admin and all the pages disappeared, including the Home page.
I had to recreate all the pages.
How can I prevent this in future? Where did I go wrong?
Thanks,
Kay
Thank you very much sir….. My website is working now… Shuu u save me God Bless you… Keep up the great work
Wow great easy to understand guide. Thanks for sharing
Thanks
Simon
Excellent tutorial! Followed these instructions exactly and everything worked! Thank you!
I did run into a few problems since I was actually replacing a wordpress database and not creating from scratch. I thought I could keep some of the same info and for some reason, kept getting a 404 error. I deleted everything, created a brand new database and user and it worked.
Do you have ideas for those of us who aren’t able to start from scratch and instead have to “replace” what we have? I feel like I was missing something obvious.
I can’t find the database…in your first step it says “make sure you are actually within the database. You should see all of the tables of your WordPress installation…” and sure enough – mine shows no tables and says “No tables found in database.”
But next to the name of the database, in parenthesis, it says (14). Another wordpress database I have has (11) after the name. I have no clue what the problem is.
haha… well if there are none of WordPress’s table in your database, you’re not in your database where WordPress is installed. You may want to ask whoever installed WordPress for you, or ask your web hosting company.
Great Post! Jason thanks for your help!!!
I did finally get everything worked out…I need to put this out there for others probably in the WP forums but my problem turned out to be case-sensitivity and the different nuances btwn Unix and Windows servers. I hadn’t needed to pay attention to that in my links on my WAMP servers…
Good grief!
I would add that I just went thru this and had a situation where on uploading the database the table prefix had a mix of upper and lowercase letters. The upper case letters got changed to lowercase on import, and then wordpress thought there were no tables and kept showing the install screen. Once the table prefix was adjusted in the config file to be all lowercase, things worked as normal.
Jason,
I hope you still read this post, because I’d love some help! I’m very new to this. I followed your instructions to the tee and could not work out why my site wasn’t showing. I hadn’t actually turned on cpanel for the site.
The first time I followed the instructions, It all looked like it was working– I even managed to get the database to load up to the live server.
But I deleted the database and started again before realising my problem was directing name servers.
So the second time I followed your instructions it worked right up to the point where I’m meant to load my sql file up to the new server and I’m getting these warnings
“import.php: Missing parameter: import_typeDocumentation
import.php: Missing parameter: formatDocumentation”
Have you got any ideas why?
Thank you so, so much for your amazing instructions.
good and complete tutorial. Can you perhaps also give us some tips on the best way to set up multi site development on a local environment?
Nice tut. Don’t forget to put the .htaccess file back to 644 when done. You don’t want public access to that important file…