This approach was first used in HTTPD server (from NCSA), and then
incorporated into Apache. Now, it is a de facto standard and present
in many commercial Web servers. How it works?
- File needs to have special extension. Usually .shtml
- Files with the .shtml are processed through
a filter which looks for HTML comments
<!--#somekeyword... --> with a special syntax.
- The special comment is replaced with dynamic content.
There are many SSI types. The popular SSIs are:
- <!--#include file="somefile" --> replaces
tag with a file.
- <!--#set var="script_dir"
value="/usr/local/bin" --> sets an environment variable (so the next
call to a script can use it
- <!--#exec cgi="/cgi-bin/list_directory.pl"
--> executes a CGI script
- <!--#exec cmd="ps -ef | grep nobody"
--> executes a system commad (here it lists processes run by user
Detailed syntax of SSI is avaliable from Apache Web site: