Lately I had to move a WordPress website between hosts, and I did almost everything one should NOT do (just for this paper, of course ), before taking a pause to think a little bit, and finally do that transfer properly. So the goal of this post is to have you benefit from my experience, the good as well as the bad. The steps explained here will work in any case. Simply, if you created your site on your own local machine, you will not have to worry about DNS transfert, but everything else is going to be the same.
In my specific case, the move had to be between an Azure website (A site) and a Linux Virtual server (B site), but the steps involved can be applied more generally to any move of a WordPress website, even if A is your own local machine. So we are going to talk about how to move a WordPress website between A and B, A being the point of origin, B the destination.
What NOT to do
Let’s start by what should not be done:
- Beginning by taking care of DNS Domain Name Transfer!!!
- To NOT change the “origin” URL in WordPress, while DNS is modified….
The consequence of these 2 actions being simply that one cannot get access to the admin part of the origin website, as the login method still point to the domain name, but the DNS wants to open site B, which does not exists yet! If I had not established an access, with MySQL WorkBench, directly to site A database, I am not sure how I would have been able to get out of the corner in which I painted myself!
What to do
- Unpack, Install
- Change of address
Thanks to computers and plugins, you’ll see all those steps to move WordPress website are much simpler than when it’s about packing your dishes…
On your existing site (A), start by removing all plugins that are not absolutely necessary, and those that might be, but can be installed quickly and simply, which you will do once you are “on the other side”. Clean your database, also. The idea being that the smaller and simpler, the better. If you install specific plugins, to clean your database, for example, remove them after use.
If you are using a cache plugin to speed up your site, disable it and empty the cache.
Remove the “real” domain name: all hosting companies have some kind of a default domain name. For Microsoft Azure, it’s “MyDomain.Azurewebsites.net”. For 1&1, it’s something like “sXXXXXXXXXX.onlinehome.com/MyDomain”. Use it now! In my case, the proper method is to change, from inside WordPress (Menu Settings/General), URL addresses to use “MonDomaine.AzureWebsites.net” instead of “MonDomaine.com”. Notice that, for now, I don’t care about destination domain (B site) and DNS.
As this is about moving, we are going to pack everything in boxes and load the truck…. I read here and there different “methods”, all using a certain number of manual typing. I am among those who think that anything which could be automated should be, mostly because manual steps involve a potential error. So I went on a hunt for a “proper” plugin. No need to go over my different trials, WordPress rich world has a number of “stinker” plugins. I elected to use “Duplicator for WordPress”, which work perfectly and matches my needs. Install it like you install any other plugin:
Settings are rather simple….
On the “Packages” screen (below), a click on the first icon “Create Package” open a popup window (above), which allow us to set the name for the new package and to see how much is taken by the files BEFORE zipping them.
Once your files are packed they are listed in Duplicator, along with the size of the zipped file. A click on the buttons Installer and Package download those files on your computer. Difficult to make it simpler.
Once you get the 2 files generated by Duplicator on your machine, you have to upload them in the destination folder of your new “B” site. DO NOT INSTALL WORDPRESS. On the other side, you need to have a MySQL Database available on your new server, to know its name, user name and password. This is a requirement in any case. You will use FTP (or SFTP) to move the files themselves. A tutorial on FTP is beyond the scope of this post, but if you need an FTP software, I would suggest using FileZilla.
(Note: It would be much simpler and faster to move WordPress between hosts to be able to send via FTP DIRECTLY from within Duplicator to the new site, instead of having to do this through your own machine. I emailed Duplicator’s author about this. This feature is on the todo list. If you subscribe to BGSoftFactory RSS Feed, you will know when this feature is available as soon as it will be the case.)
-4- Unpack, Install.
Once both files are copied into your new site folder, you can start the installation process, using this URL in your browser “DefaultHostDomain/MyDomain/Installer.php” to run Duplicator installer script
At the start, the script check if your system matches the requirements. As you can see on the screen shot above, it’s not the case here! A click on “System Requirements” will allow us to see exactly what is the problem:
It clearly shows that our destination directory is not writable. We fix this quickly (Directories permissions is a subject well beyond the scope of this post, but we need to give maximum access during the installation process, to harden security after)
Once the script detect the system matches its requirement, we need to fill in MySQL database access data. Once done, test to check if your data is correct. Check the box “I have read all warnings and notices” to enable “Run Deployement”.
The deployment process unzip the file, create tables and copy data in the database, expand all files in the new site directory. This being done, a new form offer you the opportunity to check and enter addresses and directories matching between old and new site:
Generally default values don’t need to be modified. For the new site URL, as said before, use for now your host default URL. Now we simply need to “Run Update” to end up this installation process.
Done, no error. These last steps are importants, yet I would suggest to not do them in order! Firstly, if your WordPress site origin (A site) was on Windows, the 1st step is not very important, but you can click the link to feel better. Now go on to the 3rd step, check that your cloned site behave properly, including the administration side. Finally do the 2nd step to eliminate all files linked to this installation.
-5- Change of address
Now it’s time to take care of putting our name on the door and mailbox, and let the post office know about our move. Well, I mean, in WordPress, menu Settings/General, for the URLs WordPress Address and WebSite Address, replace the default URL we have been using so far for the move and to test with your “real” domain address.
Access your DNS zone at your registrar, and point your domain name to the IP address of your new site (The exact process differ from registrar/IP). Do not forget that about one hour is needed for the change to propagate, before being able to access the new site with your real domain URL.
Move a WordPress website: Conclusion
WordPress main strength lie in its rich plugins world. Moving WordPress, be it from your local machine to a host, or between 2 hosts, has always been an important and delicate step in setting up a web site. The plugin Duplicator simplify and secure this process. I am sure many of you are aware that, as the name imply, Duplicator allow to duplicate one site many times. If you are creating niche sites, you can create a “template” on your local machine, complete with plugins, themes, pictures, logos, and so on, then duplicate it a dozen times, in much less time than it took me to write this post!
Your comments are welcome!
This work is licensed under a Creative Commons license.