Creating a static copy of a Drupal, Wordpress or other CMS website

e · l · n
Aug 20, 2020

I recently needed to sunset my old Drupal 6 blog at, as Drupal 6 is since long not getting security updates, and might not even keep working with newer versions of PHP and MySQL. I was thus delighted to find that one can create a full static copy of such a site by using the well-known wget tool available in pretty much all *nix operating systems. By creating a static HTML-archive of the site, I can keep the website for years to come, to keep links from breaking, without risking to get hacked through some vulnerability in my rusty old Drupal-installation.

The command to create a mirror into a folder under the current directory:

wget -P . -mpck --html-extension -e robots=off --wait 0.5 <URL> 

To understand the flags, you can check `man wget` of course, but some explanations follow here:

After finishing this command, you will have a folder with static HTML-files and other files, that you can just upload to your web server instead of your CMS.

Finally, you might want to add this rule to the Nginx config, to make sure the old non-.html URLs are redirected to the .html variant:

location / {
    if ($request_filename !~* (/|(.+)\.(html|css|js|gif|png|jpg))$ ) {
        rewrite ^(.+)$ $1.html permanent;

Add these lines in the appropriate server config in the relevant file, such as /etc/nginx/sites-enabled/default.

What the rule does, is that for all URLs which are not the home page (/) or static files with any of the common file extensions, it will redirect to the same URL with '.html' padded on at the end.

That's it! Visit my now archived old blog at for an example if you wish!