Or any old PHP & MySQL website
I like old websites. I like them enough to have an archive of stuff I did 20 years ago. Beyond that we have the WayBackMachine at archive.org. HTML sites that, except for a few plugins, run better today than the day they were written.
Then came WordPress, Joomla, Drupal and all the other CMSs that were underpinned by PHP, MySQL with applied skins/themes and plugins. Take any of these 10 year old sites and you don’t usually get the same output and often just a 500 error. It’s going to get worse. We are only months away from PHP 7.4 going EOL forcing the adoption of PHP 8.x which drops lots of support for old code.
What hope for a WordPress site designed under WordPress 3.8, PHP 5.6 and MySQL 5.1 running under WordPress 5.9, PHP 8.1 and MariaDB 10.5? Not much at all. These sites just decay and die without frequent updating. That’s what happened to our old website (above). The theme had been dropped by its authors. There was no way forward.
But it was an old friend. It would be nice to add it as a reminder to our archive that already contained its predecessors. Howto beyond having a VM using insecure WOL software?
There is a simple answer. A one-line command that grabs the site, converts it to pure HTML with all the stylesheets and links intact. A command to be found on any Linux server or desktop:
And here it is:
wget --recursive -H --no-clobber --page-requisites --html-extension --convert-links --domains example.com https://example.com
Or if you want to include content from other sites you expand the –domains option viz:
wget --recursive -H --no-clobber --page-requisites --html-extension --convert-links --domains example.com,example2.com,example3.com https://example.com
That’s it. You get the html code that will run on any modern server and browser reproducing the website as it was at the moment. The dynamic content will frozen to static and the website won’t be updateable or returnable to the original CMS environment. An archive of a working website frozen in time.
That’s what I wanted and that’s what I got!