in Shell

Cloning a site with Wget

The other day a co-worker was talking about moving some of his sites to a cheap static web host.  Most of the sites were either blogs, or CMSs that don’t change very often and don’t really need the overhead of a dynamic system.  I thought back about a script I had written to do this a year or so back.   The meat of the script was around a wget call which spidered a page, and then converted all the links to work with the new static documents.

wget --mirror -w 2 -p --html-extension --convert-links -P folder_to_save_to

So with this simple shell script you can specify where you want to save the converted site by replacing “folder_to_save” and then substituting the site you want to clone/mirror in for “”

There you have it a simple way to clone a dynamic site to a static one.

Write a Comment