You could do this: Work with mod_rewrite to change requests from
/some/static/page.html
to
/htmlinjector.php?url=/some/static/page.html
then use PHP (or whatever you find appropriate) to do the file-manipulation. Add an output cache to improve performance.
As an alternative, Apache Handlers sound helpful:
Modifying static content using a CGI script
The following directives will cause requests for files with the
htmlextension to trigger the launch of thefooter.plCGI script.Action add-footer /cgi-bin/footer.pl AddHandler add-footer .htmlThen the CGI script is responsible for sending the originally requested document (pointed to by the
PATH_TRANSLATEDenvironment variable) and making whatever modifications or additions are desired.
This is more or less what the mod_rewrite approach would do, only with less hackery.