Showing posts from September, 2015

Automatically appending content to served HTML - Apache and IIS

Let's say you want to append content to HTML pages you're serving - like analytics tracking code. If you're like me you're serving at least some static HTML pages and not relying on PHP or other insanity. More specifically, here are the configurations I care about: "cloud hosted" apache2 server, purely static content served out of good old public_html "cloud hosted" IIS server with a .NET-based application apache2 This is fairly simple, but involves writing a CGI script like it's 1995. Create public_html/cgi-bin as a directory Create a file public_html/cgi-bin/footer  with this as the contents: #!/usr/bin/env bash echo "Content-Type: text/html" echo "" cat "$PATH_TRANSLATED" cat <<EOF ... content you want to append goes here ... EOF Mark the file executable, e.g. chmod a+x public_html /cgi-bin/ footer If it doesn't already exist, create a new file public_html/.htaccess