Back up and move WordPress sites

Backup and Move wordpress websites

Back up and move WordPress websites

This year we made 14 new websites in WordPress, and we’re moving from one provider to another.
It is pretty straightforward to Back up and move WordPress sites, and I finally got around to documenting the steps needed to make sure all goes smoothly, with as little or no downtime as possible.

First step: Back Up

This is what I do every month anyway, regardless of development or a move. And so should you 🙂

Wordpress folders and filesBack up your WP folders

Above is what the WordPress folders look like by default. To back up everything simply select and download all these. I use the free FileZilla FTP Client for this.
Most important here, and most likely the biggest folder will be the wp-content folder. This is the folder that stores all the themes, plugins and photos in your Media library. Whenever a plugin updates it will overwrite the files here.
In case of a Major plugin update it will be good practice to at least have a local copy of this folder available, so if there is a problem with the update you can easily roll back by uploading the folder.
In case of a major WordPress update you best have the all the files backed-up.
If you are moving to another server of hoster you also need to back up all these files, and have them available locally.

Back up your database

Now you still are not safe, because all your info, posts, settings, pages, products etcetera are stored in a database, which connection settings are defined in the wp-config.php file.
Connect to your database, most people will have access to PHPMyAdmin to do this.Wordpress backup Database

In PHPMyAdmin, select the database to back up, and click export. For me the default options are set to Quick, and SQL format, and this worked fine up till now. Unless your database is gigantic this will most likely be good for 95% of all installations. Hit go, and save the file to your local disc.
Now you are save, and can restore everything in case of problems, or move to another server.

Moving your WordPress site

1st scenario: Moving your WordPress installation from a subfolder to the main folder under the domain name

If there is an existing website, and a new version is to be developed I install everything in a subfolder, and when finished just need to update 2 files to have the site active under the main domain. Up till then I can work without interrupting the visitors, test, and also the customers will have access to give feedback. In some cases I install a plugin to protect the view with a password, so if a visitor stumbles upon the work by accident, or through Google they will not have access.

Once all is finished you need to download 2 files:
index.php from the root folder of wordpress
.htaccess (if you are on apache servers you will have this. If you are on windows servers you will not, you can skip this then)

You will need to modify the index.php. Do this in notepad or any webdesign program.
Look for the line:

  • require ('./wp-blog-header.php)

And add your subfolder name to the line, like:

  • require ('./yoursubfoldername/wp-blog-header.php)

DON’T LOAD THEM YET! First, in your wordpress dashboard, go to Settings – General.

Wordpress change URL or folder

Here you need to change the Site Address field to your domain name, and leave WordPress address as is.

  • WordPress address (URL):
  • Site Address (URL):

Save the settings, and now load the adapted index.php and .htaccess to the root folder (for stand-alone sites mostly the folder public_html).
For safety reasons I usually rename the old index file in the root folder first to index_old, so in case anything goes amiss I can quickly restore the old site.

Now you can go and check the site. All ‘normal’ pages, menu’s and images should be ok, but internal links made using a full URL while building the site should be adapted.
If for example you made a link from one page to another the subfoldername will still be there in the link after you moved, and you need to check all these internal links, and edit them so they will redirect correctly.

2nd scenario: move wordpress sites to another server, no domain name change

If you are moving your WordPress site to another server, and the domain name will not change, and will be transferred to the new service too the move is not too hard to do.

Basically you follow the back-up steps in reverse, and adapt the wp-config file with the connection details for the database on the new server.

Step1: create a new and empty database on the new server.

Most Cpanels and hosting services will have an option to create a new MySQL database, or can set this up for you. What you need is:

  • dB Name
  • dB Username
  • dB password
  • dB servername (mostly ‘Localhost’, but doublecheck with your provider)

Connect to the PHPMyAdmin on the new server, select the database you have available (should be empty), select the Import option from the top-menu, select the file you saved in the Back-Up steps, and click Go.

Import database in WordPress

Step2: upload all wordpress files you backed up to the new server

Depending on your configuration with your hosting you may want to create a subfolder under the root (public_html) if you host more domains and sites, or, in case of a single stand-alone website you upload all your files into the public_html folder.

After all files are loaded to the server (may take a while, for me I upload about 100MB in 5 minutes, so if your site is 500MB count on half an hour), you need to adjust 1 file: wp-config.php, in which you need to edit the database connection details.

Wordpress configure wp-adminChange the database connection to those of your newly imported database, and upload and overwrite the old one.

In case you had no domain name change, and your folder structure was the same, you’re good to go, and all should be active. Login is the same as on the old server.
If you just requested the transfer of your domain it may take a few days before the site will be active on the new server. For me it usually takes 3 to 5 days for the .com domains to be transferred.

3nd scenario: move wordpress sites to another server, domain name or folder change

This one is the most difficult, as it will mean changing the URL’s and links in the database. If you move WordPress sites, and want to install them in another folder, or under another domain name all references to the old location of the files need to be edited to the the new location or domain name. And there will be 100s, if not 1000s of links to be changed in your tables.

First step is to follow all steps as in above ‘move wordpress sites to another server’
Then you’ll need to address the link reference changes.
Always make sure you keep the original back up intact, and work on a copy!

Luckily there is a several options available which will change all references in no time, there is the Better Search Replace plugin which I never used, but gets very good reviews. I use a stand-alone tool the DATABASE SEARCH AND REPLACE by Interconnect IT.
This will work on any database, and you do not need wordpress to run it, or a functioning WordPress admin panel, all you need is the database connection details.

Download the files, install them in a separate folder from the wordpress files, and supply your connection details.
Then you can run the tool. If for example you had the domain:


And want to change this to


You will fill in ‘’ in the Search for box, and ‘’ in the replace with box.

This is also a very handy way to test if everything is working before, you can install everything in a subfolder temporarily, e.g. in, and change all links to ‘’, and test.

And that’s generally what it takes to move WordPress sites.

Famous last words

-Always have your back-up intact and available. Do not modify your back-up, copy it and be safe. Save it to your local disk, and on an external disc.
-Before you request a domain transfer, back-up your files and database first, and load this onto the new service. I had a domain transfer which happened within 12 hours from the request. I was still loading and modifying files when it already was active..

It is not so difficult for anybody with the correct IT knowledge to back up and move WordPress sites, but if .php, FTP and database sound like Chinese to you (not intended to hurt the Chinese here in any way, feel free to replace Chinese with Russian, Greek, Marsian…), you might be better off hiring somebody to do this for you.

An IT specialist for 2 hours should cost you around 50 euro in general, saving you a lot of hassle..