How to move a WordPress site

Sooner or later the time comes: the customer changes the hoster and the WordPress installation is to be moved from one server to another. Or a newly developed site is located in a local environment (localhost) and should be uploaded to the server.

If you only want to transfer the content of posts and pages from one blog to the other, you can also try your luck with the WordPress-internal import/export function. You can find instructions on how to do this here.

Install WordPress on the new server

First you need to get the data of the new server, which you need for the installation of WordPress. This is the name of the database, the database user, the password for the database and the host name.
Then you install WordPress on the server to which you want to move the site. The installation is not difficult: install WordPress in 5 minutes.

Move WordPress site including database

If you want to move the page with all the settings, the XML export/import way is not enough. The settings of PlugIns or the Theme-Options would be lost and also the widgets do not appear in the new backend. That means you have to backup the entire database with all its contents and re-import it into the new WordPress installation.

From the WordPress backend you have no access to the database. For this you have to switch to another interface. Normally the database is accessible via the customer menu of your provider. If you log in there, you will most likely find a tool called PHPMyAdmin. With it you can manage and edit the databases.

In PHPMyAdmin you select the database you want to move and click "export". Most of the time a form appears where you can make some more settings, for example compress the database dump, z.B. As .Zip file. This file will be saved on your computer. After unpacking you should get a file with the extension .Sql have. You can then import this file into the new database. This also works via PHPMyAdmin and the button "import". So far the theory.

databases

The devil is in the details

If both installations are running under the same domain name and you have used the same database prefix in both cases, this is it. But if the names are different because the first server is for example a local installation (localhost) and the second server has a normal domain name (exampledomain.De), you have to change this information in the sql file, just like you have to change the database prefix.
You can do this in a text editor and replace the URLs via search & replace. Or you can use the plugin Search and Replace by Frank Bultge. So you can make the changes directly from the WordPress backend.
Now you can import the sql file into the new database. You might have to empty the database tables of the new installation before that. The data would be overwritten either way.
In some cases not all data is transported. Then for example the widgets and their contents are missing. This is because WordPress stores this data in a special way, the keyword is "serialized data". Not only the content, but also the length of a string is stored. If the new domain name has a different number of characters than the old one (from example.En becomes newexample.De), the data does not arrive. Otto (aka Samuel Woods) explained this in a thread on stackexchange.

There are special PHP scripts (for example this one) that fix this problem. How to use it is explained in the thread linked above on Stackexchange.

Why complicated, when it can be simple?

Now I make exceptionally advertisement for a PlugIn, which one must buy. Although there is a free version WP Migrate DB, but the really fancy features you get only if you take $ 29 in hand. But the PlugIn WP Migrate DB Pro is worth the 29$. It ensures smooth transfer of all content and setting from one WordPress installation to another.

WP Migrate DB Pro makes life as easy as can be. With a single click the data is sent from one installation to another. The transfer takes only a few seconds and everything, but really everything arrives. Even the login data, so don't be surprised if suddenly the old password doesn't work anymore.

By the way, the developers of delicousbrains are very helpful and friendly. I bought myself a developer license and now use WP Migrate DB Pro on all our projects.

Leave a Reply

Your email address will not be published. Required fields are marked *