Categories
WordPress

Creating a Static Web-site from a WordPress Blog

I have an old WordPress Blog that I created circa 2005, which is no longer updated. In order to remove the need to (constantly) update the version of WordPress, themes, plugins etc. and to create a version suitable for archival purposes, I decided to convert the blog to a Static web-site.

It was difficult to find a suitable WordPress plugin to do the job so I deciced to look for alternative approaches. One way of doing this is to use a software application such as HHTrack, a free (GPL, libre/free software) and easy-to-use offline browser utility, that will create a copy of
a web-site on your local computer.

https://www.httrack.com

It allows you to download a World Wide Web site from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer. HTTrack arranges the original site’s relative link-structure. Simply open a page of the “mirrored” website in your browser, and you can browse the site from link to link, as if you were viewing it online. HTTrack can also update an existing mirrored site, and resume interrupted downloads. HTTrack is fully configurable, and has an integrated help system.

The existing blog consists of just under 600 posts/pages and has approx 150MB of media files.

Before starting, I backed up the WordPress directory and related MYSQL database on the server.

An initial run of HTTrack successfully created a version of the blog as a static web-site that seemed to work OK and highlighted a number of issues and limitations.

  • Comments do not transfer – This is not a big issue for me, although it should be possible to come up with a suitable work-around for handling these if necessary.

The first thing I did was to check the WordPress plugins being used, removing those that were not relevant for a static website. I also wrote a small plugin to remove/disable the current Responsive Images feature in WordPress.

It was interesting to note a variety of different techniques used for embdedding YouTube videos in the blog pages – this was caused by differing techniques evolving over the time that the blog was written (10 years+) and I decided to ensure they were consistent through the site using the embed code provided from the YouTube site.

I also decided to migrate the blog from HTTP to HTTPS as part of the exercise. The WordPress theme being used has some hard-coded urls using HTTP so I edited these to use HTTPS.

I then ran the HTTrack utility to create a local copy of the blog, in fact I ran the utility a number of times checking and tweaking details in the blog between each run. The utility provides a helpful log of warning/error messages that occur during the run

Final steps included mass-file editing of the local files to convert HTTP references to HTTPS and other clean-up operations on the final files.

I also created a zipped up copy of the original blog files and MYSQL database, which have now been archived, in case I ever need to return to the original blog.

1 item not addressed during this process was how to handle referenced URLs which have expired. An expired URL is one which is no longer valid because the original destination has changed or disappeared completely. I have a few ideas how to handle this phenomenon if I can ever find the time to explore it further.

Other Links

http://redirectdetective.com/creating-redirects.html