LinuxHelps.com

A blog for Linux Lovers.

Posted by sibu on October 17, 2009

Enable Server Side Include(SSI)

SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served.  Its use to add dynamically generated content to an existing HTML page.

SSI configurations

We must have mod_include module installed and enabled on apache. Also need to  have the following directive either in your httpd.conf file, or in a .htaccess file:

Options +Includes

This tells Apache that you want to permit files to be parsed for SSI directives.

It always better to tell Apache that which files should be parsed. There are two ways to do this. We can configure to parse any file with a particular file extension, such as .shtml, with the following directives:

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

One disadvantage to this approach is that if you wanted to add SSI directives to an existing page, you would have to change the name of that page in order to give it a .shtml extension.

The other method is to use the XBitHack directive:

        XBitHack on

XBitHack tells Apache to parse files for SSI directives if they have the execute bit set. So, to add SSI directives to an existing page, rather than having to change the file name, you would just need to make the file executable using chmod.

chmod +x pagename.html

Add A Comment