I need to add a script before the </body>
tag, so instead of modifying all the pages, I was wondering if I could configure the server to add some HTML before that tag for every HTML document being served?
views:
148answers:
3The most natural answer to your problem would be to use a server-side processing language such as PHP, CGI, etc. Those platforms give a lot more than just server-side includes. Speaking of which, if including something in an HTML page is just really what you need, you might be looking for Server Side Includes.
If you have PHP installed on your server, you can set up the auto_append
and/or auto_prepend
directives in the php.ini file or .htaccess. You can also set up .html extensions to be parsed as PHP files by Apache, so every HTTP request for an .html document is sent back with a header and a footer automagically included. If PHP is set up, try adding these lines into your .htaccess:
AddType application/x-httpd-php .html
php_value auto_prepend_file /var/www/public/foo.html
Apache can handle that using mod_layout
Here's a relevant article: Advanced Apache Headers/Footers