Moving a WordPress site to a new server
Moving an ordinary website from one server to another is generally no problem. The method is to copy across the files, and then to redirect the domain to point to the new server. Sit back and wait, and shortly the new site will go live and the old can be deleted.
Moving WordPress is a little more complex.
The problem with WordPress is that it is heavily integrated, not just with its database and domain name but also with the actual structure of the server. Recently I decided for various reasons to move this site and this is more or less the sequence of events. Note that I could have made the job slightly easier by taking some shortcuts, but when working with a live site, it is better to be cautious and take things one step at a time.
Firstly I set up the new webspace and pointed a spare domain at it. Once it was running, I set up a new database. I then installed WordPress and made sure all was running smoothly. At this point I had a full WordPress installation running that had no connection at all with the site I was moving. Now was the time to start integrating.
The first thing I did was to download all the files from the old site. I then uploaded all files – EXCEPT wp-config.php to the new server. If I had copied wp-config.php, the new site would just point to the old database, which contains the live domain so any testing would just redirect to the old site. At this stage I could test the appearance and plugins. At this stage, the new site should be almost identical to the old site, but won’t contain any posts, comments and so on.
I then made a dump of the database from the old site, but did it in two chunks – All the tables EXCEPT _options, and _options on its own. The former, I inserted into the new database and tested to make sure all the posts were correct. The latter file has to be manually edited.as it contains absolute path references.
For example, one field in the old file contained the following –
That refers to the location relative to the root of the server and is going to be different on any other server. All that is required is a simple find and replace to update the information from the new server. If you are not sure, just check the _options record on the new installation, and you will find it there.
Once the file is edited, save and upload to the new database.
Now comes the nerve wracking bit.
First I pointed the live domain to the new site using my control panel. If the IP address of the new server is different (more than likely it will be) then the live domain details need to be changed on the DNS server. Once that is done, just sit back and wait.
During my waiting period, I repeatedly checked the live domain. At one stage, it broke, giving pure text on the screen with no formatting or graphics. That only lasted a few minutes however, as all the parts became synchronised.
So you are now reading this on the new server. Hopefully you won’t notice any difference whatsoever.
If you do see any differences, then break it to me gently!
Moving a WordPress site to a new server — No Comments
HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>