DIY & Music & Guitar & Beer & Tech

Move WordPress to another server

This is maybe not so usual situation but nevertheless one that I had to deal with, so here goes. Possibly mostly as a reminder of the steps (as I tend not to remember these , abit boring tasks). I had my previous WP instance hosted at common web hotel with their own control panel as the (almost 🙂 ) only means of access. I started out by creating the new server, installing fresh WP there and google for ‘move WP from…to…’ with mixed results. It seemed that there is a plugin but many complain that it didn’t work that well. I decided to try it anyway.

I could export post/page/theme/ data to XML and (after installing import plugin on the new server) import it in the new instance. Text appeared but no images were imported. I tried couple of times same procedure with some more info from google but no luck. Then I SCP:ed complete site (from old server) to local drive and copied plugins and uploads to the new site. No images were imported to the media library but for that I used plugin called ‘Add from server’ which scanned the uploads folder (or basically any folder you specify) and imported images. Problem with the before mentioned XML export file is that the images pointed to ‘…/image.jpg’ and my new server didn’t yet had any domain attached to it. What happened was that I could see images but they were served from the old site. Now after importing media files to the library I figured that after changing DNS settings (when I’m done with the migration) media files will be served from the same domain but at that time from the new server as it will have DNS assigned to it. Long story short – it worked as I thought.

Refresh in the browser and all plugins are recognized. I had to activate them one by one manually but took only half a minute – so no problem there. I had to move widgets and tags a bit for the theme to make it look like the old one. Few minutes there and It looked exactly like the old one. Last thing was to install SSL cert on the new site and adjust .htaccess, wordpress settings for host (don’t forget to actually put HTTPS as protocol in WP!) and apache files for that. After that I couldn’t  see the new site (as expected) because it redirected to the which still was pointing to the old provider. I went and changed the DNS records to point to the new server. 12:ish hours later everything just worked. Https (with rewrite engine) is the default protocol, everything looks like the old site only thing was to cancel the old hosting provider which I did with pleasure. The old server was a bit sluggish as well, this one is the smallest instance @digital_ocean and it feels fast as hell.

Less business for them more fun for me. 🙂

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.