Home > Web hosting - Linux. > Using SSI ( Server Side includes) on the Linux webhosting platform.

Using SSI ( Server Side includes) on the Linux webhosting platform.

Writing CGI in perl means you can quickly add interactivity or deal with web forms. Whilst you may call a CGI either from a FORM or directly from an HREF, you may wish to include script output, or html, directly into a webpage.

Our web server can parse your html, to include either output from a script or other templates, using SSI (Server Side Includes) but you need to enable this first.

To enable SSI, for the default .shtml files, add the following line to a .htaccess file in the affected web folder or one of it’s parents :-

Options +Includes

If you would like to parse files with other extensions you can enable this by adding the following to your .htaccess
file (.html in this example) :-

AddOutputFilter INCLUDES .html

Once you have enabled parsing you can add includes into your file text as detailed in the following examples :-

<!–#include virtual=”anotherfile.html”–>
<!–#include virtual=”/somedir/anotherfile.txt”–>
…and in order to run scripts:
<!–#include virtual=”/cgi-bin/user/someone/myscript.cgi”–>

For complete documentation please check the Apache web site: http://www.apache.org/docs/mod/mod_include.html