Chapter 2. Problems with Server Side Includes (SSI).

Table of Contents
SSIs don't work for VirtualHosts and/or user home directories. What's wrong?
What other ways are there to do includes?
How can I use ErrorDocument and SSI to simplify customized error messages?

SSIs don't work for VirtualHosts and/or user home directories. What's wrong?

This almost always happens because you don't have "Options Includes" set correctly in your httpd.conf. The issue is that it only applies where you set it and no where else. Each virtual host needs its own "Options Includes" statement for this to work. You will also need to ensure that the .shtml file extension is set up with AddType and if you plan to implement an index.shtml you will need to make sure that the DirectoryIndex for index.shtml is enabled if you plan to use pure SSI and .phtml should be enabled if you plan to use php/fi like this:

DirectoryIndex index.html index.htm index.cgi index.shtml index.phtml

The SSI directive which goes in your HTML file looks like this:

             
   <!--include file="file_name"-->
          

The angled brackets here do not get shown by browsers so don't worry about that. Anything inside them is interpreted as a comment by the browser and as a directive by Apache.