PHP Class for modifying old HTML static copies / mirrors
Ok you made a static mirror(maybe with HTTrack, maybe with something else) and you still want to host it somewhere, but you also want to make a change to all the static pages without modifying each and every one of the files. In that case, you need to load that file using a script that reads the file at the time of loading then makes the changes you want and after that displays it. Sound simple enough so I made a PHP class that does just that and I even wrote 2 flavors of the script to work on an ancient PHP version( and by ancient I mean around 2010 5.3.x).
The idea is simple, first, redirect all request to the script using your web server configuration here is a simple apache .htaccess example:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.html$ HaCopyAn.php
Then here is the class for newer PHP Versions(it will be instantiated in the script too):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.html$ HaCopyAn.php
And now for an ancient PHP version:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.html$ HaCopyAn.php
As you can see, there isn't a drastic difference between the syntax of both flavors.
Anyway here is a zip archive if you want to download: [download id="4"].