A few days ago I installed a local instance of WordPress under Windows, to experiment with importing my
https://grenville.wordpress.com site. This post documents a small problem and solution with some of my current blog’s images being identified using https:// instead of http:// URLs.
After confirming the Windows WordPress installation was up and running (with an essentially empty blog), I created an export of
https://grenville.wordpress.com into a local xml file,
Importing this xml file into my Windows WordPress installation, with “download attachments” checked, did a reasonably good job of recreating my blog on the local machine. All posts, pages and comments re-appeared, and a vast majority of my images were pulled over as well.
Unfortunately, a sizable number of images were not retrieved. My local instance of WordPress complained multiple times with the same error message: “Failed to import Media ….”
Some online searching threw up the following informative blog post:
The hint (which turned out to be accurate) is that some of my current blog’s images are referred to using https:// rather than http:// URLs. While doing the importation process, my local WordPress was barfing at being presented with a site certificate when attempting to retrieve https://grenville.files.wordpress.com content, and so each affected image was simply failing to import.
The partial solution was to run through the .xml file and convert each instance of
https://grenville.files.wordpress.com — the resulting xml file could then be successfully used to ‘import’ my current blog site into the locally hosted instance of WordPress. From my FreeBSD command line:
cat thinkingtoomuch.wordpress.2012-09-04.xml | sed 's+https://grenville.files+http://grenville.files+' > revised.xml
does the trick (with
revised.xml being the file you now use to import the blog)
Unfortunately, although my images are now all imported, scaling information appears to have been lost during importation (so my Posts have galleries where the thumbnail previews are all the wrong sizes). Figuring out why is still on my TODO list….