Static website mirroring with wget

Recently I was moving several old sites to a new server. Some are old Wordpress installations, and though they are not updated anymore, I wanted to keep them online for posterity. However, setting up PHP and MySQL on the new server to get these sites up and running again would have been a real hassle.

After searching for several solutions, it turns out that the simple wget tool, pre-installed on most Linux systems, does everything I needed. For a Wordpress site, point it at the home page, and it will follow all of the links on that site, and download them for you. Not just that, but it can change .php extensions to .html and rename any links so that they point to this newly named page.

Of course, this is not limited to just Wordpress, but any website at all which you want to archive. Run the command below pointing to the website you want to back up, and you will get a folder locally which you can upload to your new server.

wget --mirror --convert-links --adjust-extension --page-requisites --no-parent https://example.com

If you need a simple way of setting up a server for static sites with https, try my site-manager scripts.