Backing that WordPress site up
- Save WordPress site via FTP
- Copy the database
- Install copy of wordpress on new domain
- Upload files
- Delete default database
- Upload saved database
- Run SQL to change domains
- Verify Working
1. Save WordPress site via FTP
Make sure you have a valid FTP username and password.
You can either use a program such as fileZilla, or if your hosting provider has CPanel or a backend FTP managment system you can use that. I enjoy programs on my computer over web based ones because it remembers the last few I’ve been working on so I can swap between projects or get back to a recent one without having to remember who is hosting them.
Log in and download ALL of the files. You’re right, you don’t need them all, but you also don’t want to use a different version when you aren’t 100% sure that it isn’t going to destroy what you are working on.
2. Copy The Database
So at this point you will have to log into the hosting provider of the website and find out where they keep their databases. You will need a username and password to log into the database, but it will be in the wp-config file you just downloaded from the FTP. After logging in, if you are using phpMyAdmin you should see the database on the left and on the right, some tabs and tables with data under it. Look for ‘export’ in the tabs, click it, then scroll to the bottom where you can ‘save’ the database. There is a little checkbox that only opens the sql in a new window instead of actually saving it, and by default it is checked, so you have to uncheck it to actually save it. The name __database__ is a variable for the database name, so I generally don’t change it.
3. Install Copy of WordPress on New Domain
Pretty simple, I usually just have my hosting provider install a new copy (if you are installing a local copy that’s it’s own story, but very fast). This is because one of the reasons I am probably backing my site up, is because I want to see if the new version of wordpress is going to effect any of the plugins, or the theme itself in any negative way.
4. Upload the files
Remove the newly installed wp-content folder, and replace it with the files you downloaded. This can take a bit of time. You could open the new wp-config file before you start this so you can start the next step while this is going on.
5. Delete default database
Log into your hosting provider, find the database, log in, and drop all of the tables in it.
6. Upload Saved Database
Basically the exporting the database (step 2) in reverse. Instead of going to ‘export’ go to ‘import’ and upload the .sql file you saved in step 2.
7. Run SQL to change domains
UPDATE wp_options SET option_value = replace(option_value, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET guid = replace(guid, ‘http://www.old-domain.com’,’http://www.new-domain.com’);
UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’);
Pretty simple, copy paste the above code into the SQL portion of the database manager (phpMyAdmin for me), after changing the old-domain and new-domain to the appropriate names. If you can’t remember the old domain, open the wp_options table and near the top you should see it. After running the query, you should have 2 changes from the first line, and a bunch from the other two. If you don’t then there was an issue.
8. Verify Working
After this point you should have a working version of the site copied. Make sure that more then just the home page works. Check plugins, make sure images are loading from the new site and not from the old one. Sometimes if you hard code links in, they will not change from the sql updates and you have to find them and change them (that is clearly not a smart way of doing things, but sometimes you are dealing with other peoples websites).