How do you enable SSI's in Apache?

I've found information on the web, but it just doesn't make sense to me. I'd like to know exactly what files I should go into, and precisely where and how I should modify them.


Solution 1:

This has to be enabled (or the equivalent for your OS):

LoadModule include_module libexec/apache22/mod_include.so

And these added for the standard method:

AddType text/html .shtml
AddHandler server-parsed .shtml

#This one goes in the <Directory> directive you want them enabled for (ie "/")
Options +Includes 

OR the --x bit hack:

XBitHack on

This last one allows you to keep the normal html name, but chmod o+x file.html and enable SSI just for that file(s).

Everyone else pointed to the old version of the documentation: Apache mod_include Docs

Solution 2:

When having

SSILastModified on 
XBitHack full

The setting "SSILastModified On" is a silent misconfiguration, because whether "SSILastModified" is on or not, it does not change any program behavior.

By tracking back to the source code of Apache, we can see the root cause of this misconfiguration is that the semantics enabled by "Xbithack Full" implicitly overwrite the semantics enabled by "SSILastModified On".

if (conf->lastmodified > 0) {
  ... {
   ap_update_mtime(r, r->finfo.mtime);
   ap_set_last_modified(r);}}

else if (((conf->xbithack == XBITHACK_FULL ||
         (conf->xbithack == XBITHACK_UNSET &&
                DEFAULT_XBITHACK == XBITHACK_FULL))
        ...)) {
        ap_update_mtime(r, r->finfo.mtime);
        ap_set_last_modified(r);
}

Similarlly, having "Xbithack full" will also overwrite "Xbithack on" Herein, one possible solution is to check whether "SSILastModified on" or "Xbithack on" is in your configuration file. If yes, please change it to "Xbithack Full".