You want to enable Server-Side Includes (SSIs) to make your HTML documents more dynamic.
There are at least two different ways of doing this.
Specify which files are to be parsed by using a filename extension such as .shtml. For Apache 1.3, add the following directives to your httpd.conf in the appropriate scope:
<Directory /www/html/example> Options +Includes AddHandler server-parsed .shtml AddType "text/html; charset=ISO-8859-1" .shtml </Directory>
Or, for Apache 2.0:
<Directory /www/html/example> Options +Includes AddType text/html .shtml AddFilter INCLUDES .shtml </Directory>
Add the XBitHack directive to the appropriate scope in your httpd.conf file and allow the file permissions to indicate which files are to be parsed for SSI directives:
SSIs provide a way to add dynamic content to an HTML page via a variety of simple tags. This functionality is implemented by the mod_include module, which is documented at http://httpd.apache.org/docs/mod/mod_include.html. There is also a howto-style document available at http://httpd.apache.org/docs/howto/ssi.html.
The first solution provided here tells Apache to parse all .shtml files for SSI directives. So, to test that the solution has been effective, create a file called something.shtml, and put the following line in it:
File last modified at '<!--#echo "LAST_MODIFIED" -->'.
Accessing this document via your server should result in the page displaying the date and time when you modified (or created) the file.
If you wish to enable SSIs, but do not wish to permit execution of CGI scripts, or other commands using the #exec or the #include virtual SSI directives, substitute IncludesNoExec for Includes in the Options directive in the solution.
Some webmasters like to enable SSI parsing for all HTML content on their sites by specifying .html instead of .shtml in the AddType, AddHandler, and AddFilter directives.
If, for some reason, you do not wish to rename documents to .shtml files, merely because you want to add dynamic content to those files, XBitHack gives you a way around this. Of course, you could enable SSI parsing for all .html files, but this would probably result in a lot of files being parsed for no reason, which can cause a performance hit.
The XBitHack directive tells Apache to parse files for SSI directives if they have the execute bit set on them. So, when you have this directive set to On for a particular directory or virtual host, you merely need to set the execute bit on those files that contain SSI directives. This way, you can add SSI directives to existing documents without changing their names, which could potentially break links from other pages, sites, or search engines.
The simplest way of setting (or clearing) the execute permission bit of a file is:
# chmod a+x foo.html # turns it on # chmod a-x foo.html # turns it off
The XBitHack method only works on those platforms that support the concept of execute access to files; this includes Unixish systems but does not include Windows.