Server-side includes or SSI is a simple server-side scripting language used almost exclusively for the web. As its name implies, its primary use is including the contents of one file in another.

Table of contents
1 Basic syntax
2 Directives
3 External links
4 See also

Basic syntax

SSI has a simple syntax similar to "<!--#directive parameter=value parameter=value-->". Directives are placed in HTML comments so that if SSI isn't enabled, users won't see SSI directives without viewing source.

Directives

These are the most common SSI directives:
Directive Parameters Description Example
include file or virtual This is probably the most used SSI directive, allowing the content of one document to be included in another. The virtual parameter, which specifies the file or script to be included, should be used instead of the file parameter. <!--#include virtual="header.html"-->
exec cgi or cmd

If the cgi attribute is used, it should be the path to a CGI script to be executed. The PATH_INFO and QUERY_STRING of the current SSI script will be passed to the CGI script. include virtual should be used instead of exec cgi.

If the cmd attribute is used, it should be a shell command to be executed. The output of the command will be included in the page.

<!--#exec cgi="/cgi-bin/foo.cgi"--> or <!--#exec cmd="ls -l"-->

External links

See also