How do I enable SSI for .html or .shtml files on my server?

Question:

How do I enable SSIs (Server-Side Includes) for .html or .shtml files on my server?

Answer:

To enable SSIs for .html or .shtml files on your server, there are a couple directives that must be inserted into the vhosts.conf Apache configuration file that will instruct Apache to parse the .html and .shtml files for server-side includes.

Software:

Apache

Detail:

Apache must be instructed on how to read files that are accessible through a web browser.  Some files are displayed in just their text value, some in HTML, and others are specially parsed to display different things in the browser.  In the case of SSIs, Apache must read these files as HTML/text, but also look for executable files, such as PERL or CGI programs, that are imbedded in the text file.

Solution:

To enable SSIs for .html or .shtml files on your server, log into your server and cd to the directory /www/conf/  Now edit the vhosts.conf file.  For each domain that SSIs are to be enabled, insert the following directives into the domains' VirtualHost block:

AddType text/html .html .shtml

AddHandler server-parsed .html .shtml

To make this change global for the whole server, so that all domains on the server can have .html and .shtml files parsed for server-side includes, place the directives right below the line " ServerRoot "/usr/local/www" ", which is the first line after the comments that start the vhosts.conf file.  These two lines can also be placed in a .htaccess file to restrict SSIs to a single directory.