Create a Static HTML Site from WordPress

The question:

A friend of mine is investigating the use of WordPress for a dynamic site with some hierarchy. Really, at the moment he just wants “nothing fancier than photos and links between pages,” but knowing him, it’s going to get more complex from there.

The tricky requirement, though, is that he needs to be able to archive the site. As in, output a static HTML version with embedded resources (photos) to a CD for manual distribution from time-to-time.

I’m pretty sure this is possible with WP, since that’s actually how several caching systems work. But I don’t know of any plugins that give you a simple “export site to disc” function. Is there such a plugin?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Turn on pretty permalinks, and run a spider/archiver on the address of your website. This should give you a static site you can place on a CD/DVD/USB drive.

You can use a tool such as http://www.httrack.com/ to do the latter part. If you’re on linux you can use the following command:

# Mirror website to a static copy for local browsing.
# This means all links will be changed to point to the local files.
# Note --html-extension will convert any CGI, ASP or PHP generated files to HTML (or anything else not .html).
wget --mirror -w 2 -p --html-extension --convert-links -P <dir> http://www.yourdomain.com

You can also run a portable wordpress install off of a USB drive http://wordpress-portable.webnode.com/

Method 2

You might want to give this tutorial a try:

http://mossiso.com/2009/07/20/convert-wp-to-static-html-part-2.html

There is also a script you can run via command line

http://mossiso.com/code/make-wordpress-static


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment