Creating a Static Website based on a WordPress Website?

I am doing this right now (still in process). The best setup seems to be:

  1. Add the .html extension on posts – easy, just use custom post pattern

  2. Add the .html extension on pages – need a plugin for that, if you use pages

  3. Disable feeds (in function.php by removing headers for it)

  4. Use wget from the command line:
    wget -x -nH -P scraped -np -k -R php -E -X wp-content,wp-includes -m http://address/siteroot/

    This sucks down your site, changes WordPress-style directory URLs to .html URLs, changes internal links to relative, etc. Feed URLs on all levels (root, category, article, etc) mess this up, which is why they have to be removed.

    Obviously, the assumption is that the site is fully reachable from the root. If that’s not the case, use a sitemap plugin (as you yourself mentioned) and scrape from there.

  5. Run some sort of processor to remove http://address/ or change it to absolute root of your static site. If you need to move directories about (e.g. media/uploads), that’s a little more difficult.

This should get you about 80% of the way.

If you do end up going this way, track me down when you know more and I will share the rest of the setup from my work computer. (If more than one person needs this, rank this up and I will put it somewhere public in a month or so, once fully done.)

Leave a Comment