Creating a Static Website based on a WordPress Website?

I am taking on a project where I need to build a static website (due to hosting restrictions).

I thought of trying to do this by building a WP site on my computer, then creating a sitemap, and then ripping that site, and finally uploading the files to the host.

Read More

Any better suggestions on how to do this? (or any good reason why I shouldn’t even try)

Related posts

Leave a Reply

3 comments

  1. 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.)

  2. From your comment I believe there are two better options, that will keep development time down and your sanity in check.

    1) If you have PHP w/ PDO, then you could look at using this plugin http://wordpress.org/extend/plugins/pdo-for-wordpress/, which will let you use sqlite as a database. Note: WordPress was designed around and for mysql, your results may vary using a different sql backend.

    2) If all you have is some basic php modules. I would just create the site with a group of includes. To where you are creating a series of “templates” using php includes. I would have a php file for the header, footer, home page and inner page. If you have multiple inner pages. I would pull any similiar layouts out into a separate page and include those for each type of inner page. Then put all your content in the inner pages. Then with your index.php create some basic code that loads up the pages you want based on the URL coming in. You can use .htaccess with mod_rewrite (assuming apache) To convert nice urls to something like /about-us into /index.php?template=inner&page=about