I’ve moved simonhawketts.com to self-hosting
Any regular reader of this blog will possibly notice that it has a different look today. That is because, after thinking about it on and off for a couple of years, this morning I took the plunge and moved my site from wordpress.com to a self-hosted site. If your dns settings have updated, you will see this post in the style of the new blog here on the left; if they haven’t you have a small amount of time left to enjoy the old look 🙂 .
I originally though about doing this a couple of years ago, but didn’t because I was concerned that I would need to spend too much time carrying out site maintenance rather than writing posts. In the last year however I’ve started another site, found-film.co.uk, and found that the actual time needed to do the server maintenance is quite low so I decided it would be a worthwhile change.
Although it’s probably not of great interest to many people who normally read the vintage camera and photography posts here, I’m going to outline the areas of the process which were troublesome for the benefit of anyone else who is considering making this change.
On the face of it, it should be a simple operation to export the content from the original blog and import it into another wordpress site. On the original site you go to the tools menu in the Admin screen and choose export. Then you can export the whole site as an xml file which is used to import the content to the new site.
Actually, there were problems straight away with this because I generated a file of about 60M doing this which is too big to feed into the import function of my new site. So the first thing I needed to do was use a program called WordPress WXR file splitter which allowed me to split it into 8 parts which were more manageable. Once I’d done that I imported the site in stages by feeding each of the 8 files in turn into the import function. However, although this imported the content there were still things wrong.
The first thing was the internal links which I’d put into the content over the course of the 5 years or so the site has been up. These all pointed to locations on https://simonhawketts.com but the new site runs on a different domain http://simonhawketts.co.uk, so I had to change every link to point to the new site. Obviously, I wasn’t going to hand edit 700 odd posts, so I used a plugin called ‘Search & Replace’ to search through the database and make the updates. This gives the option to do a dry run first and also produce a backup of the database prior to running the change for real.
With that change made things were closer to being correct, but there was still a problem. Over the years I’d made changes to the URL of various posts, and those settings were saved as redirects on the old blog. Those redirects don’t export however, so there were lots of internal links which were broken. Adding redirects to fix them was relatively easy, but I needed to find all the broken pages. To fix this I wrote a short script which took the xml sitemap from the old site and went through each url, changing the hostname from simonhawketts.com to simonhawketts.co.uk (the domain of the new site) and testing to see if the page existed. If it didn’t exist it would make a 404 entry in the new site’s redirection table so I could then go in and convert them to proper redirects.
I don’t have many videos on this site but the few I have were running under the WordPress.com video CDN and that had to stop when I moved to self hosting. That was actually a reasonably easy change to make – I downloaded them all from wordpress and uploaded them to my youtube account. Then I took the embed url and replaced the wordpress video short code with the relevant youtube embed. The only thing I did to taylor that embed was to remove the suggested videos which would normally appear at the end of a video.
Doing the Transfer
The actual transfer took longer than I intended, but was also, in the end easier than I thought.
What I’d intended to do was purchase a Site Redirect option from WordPress which would redirect my traffic from the old blog to the new. When I started doing this however I found that I couldn’t actually go through with the purchase because it wasn’t compatible with my wordpress plan (which was the business plan). After a series of email exchanges with wordpress.com support they suggested a mechanism which was slightly slower but had the advantage of not costing anything.
So this is how I eventually did the transfer.
I set up a DNS entry for the old blog domain name of simonhawketts.com on my new server and also set up a virtual server configuration for that domain. I then added a permanent redirection clause within the virtual server configuration to direct all traffic from simonhawketts.com over to simonhawketts.co.uk.
Once I’d done that and tested everything worked on my local PC (by setting a local hosts entry which pointed simonhawketts.com to my virtual server’s IP address), the plan was to change the simonhawketts.com name servers at wordpress.com so they pointed to my new setup, and I would then have control of both domains. This worked, although there was a small amount of down-time whilst I generated an ssl certificate for simonhawketts.com (which could only be done after I’d changed the name servers) but that only amounted to 10 minutes and then the change was done. The only step remaining is to transfer the actual domain registration to my normal domain registrar and then I’ll have full control of the site.
One useful side effect of doing the transfer this way is that the old site is still preserved on the wordpress.com site and I can easily switch back the DNS settings if I want anytime up to the date my current wordpress account expires. So if I find in the next few weeks that self-hosting is more trouble than it’s worth I can change my mind.
With all that done I’m hoping that I can now get back to writing some posts about photography and vintage cameras !