How To Create an HTML Flatfile Instance of a Website

You are here:
< All Topics

To create an html flatfile replica of the WordPress website http://kevwells.com the challenge was to get the output from the php content files as html.

 

 

This problem was resolved in the following way:

 

 

Launch an instance of the php webserver process on port 8080

 

 

NOTE this has to be executed from the top of the website document folder tree ie in /var/www/html: 

 

 

root@gemini:/var/www/html# php -S kevwells.com:8080
[Thu Jan 6 22:36:44 2022] PHP 7.4.3 Development Server (http://kevwells.com:8080) started

 

 

 

Then in another terminal window execute the wget command:

 

 

wget -r –mirror –page-requisites –convert-links -U mozilla -F http://kevwells.com:8080

 

 

NOTE: We do not use the “span hosts” wget option  – else this will download all the external sites that are linked as well.

 

this then generates and downloads a static html flatfile instance of the website.

 

this can then be accessed from a web-browser by using the URL file:///<filesystem location of the wget output>

 

 

eg

 

 

file:///home/kevin/DATA/KEVWELLS.COM/kevwells.com_FlatHTMLfiles/kevwells.com/

 

The location folder must be made available first in NFS for clients to connect to.

 

Alternatively the html folder tree for the downloaded site can be  copied to any other machine and accessed locally from there.

 

This displays a file system based instance of the downloaded website.

 

 

 

 

 

 

 

 

this method downloads the website as flat html files, you access the site instance via the file:/// reference in the browser URL field.

in other words, it does not convert the internal website links to pages and posts into localhost referenced links.

but it means you do have a local instance of the site containing all the content as flat html files.

Table of Contents