The full documentation for the Apache web server may be found at this URL: http://mauve.rahul.net/manual/index.html. The documentation for the syntax of lines that use server-side includes may be found at this URL: http://mauve.rahul.net/manual/howto/ssi.html. Note: Not every feature described in the above manuals is available here.
Server-side includes are active for any document whose name ends with .shtml . Special directives in the file will be processed by the web server before it is sent to the web client requesting it.
Some features (primarily program execution from within server-side includes) are available, by special request, to Premium customers only.
<strong>
Local time is <!--#echo var="DATE_LOCAL" -->.
</strong>
The result looks like this in the final document:
Local time is Sunday, 07-Apr-2013 16:43:02 PDT.
Reload this page in your web browser to see the timestamp change.
Here is another example, for a regular document. Consider the URL http://www.rahul.net/ssidemo/somefile.txt . Again, from this URL, delete the http: part and the domain name part. What is left is the string /ssidemo/somefile.txt . Again, this is the virtual path of this document.
A virtual path looks like a UNIX pathname, but is not exactly the same as one, because it begins at the web server's root directory and not at the filesystem root directory.
<strong>
Included text coming up:
<!--#include virtual="somefile.txt" -->
... done.
</strong>
Then the contents of 'somefile.txt' will be included at the point where
the #include virtual is done. You already saw the contents of
'somefile.txt' if you followed the link to it, in the section where we
defined virtual paths. The same text, taken from inside somefile.txt,
will be automatically included into this document due to the #include
virtual line. Here is the final result:
Included text coming up: I am somefile.txt, and the rest of me has the alphabet: abcdefghijklmnopqrstuvwxyz ... done.
The filename used in the #include virtual directive may be a simple filename in the same location as the document that includes that file, as in the example above. Or it may be a pathname relative to the location of that document, e.g., 'subdira/subdirb/somefile.txt'. Or it may be the virtual path of the document, as we defined it above.
Don't use a full URL, including the http: part or the domain part, in an #include line -- it won't work. Here is an example that won't work:
<!--#include virtual="http://www.rahul.net/ssidemo/somefile.txt" -->
But a virtual path, like the one shown below, will work:
<!--#include virtual="/ssidemo/somefile.txt" -->
In an #include virtual line, if the filename end with .cgi the web server will assume it is a program to be executed, and will include the output from that program into the including file. Also, if the pathname corresponds to the virtual path of any cgi-bin program, program execution will occur, without the .cgi suffix being required. Here are some examples.
Suppose we have a little shell script like this:
#! /bin/sh
# This is the shell script 'printalpha.cgi'
echo 'Content-type: text/plain'
echo ''
echo 'printalpha.cgi says: abcdefghijklmnopqrstuvwxyz'
Let's use the following lines in our document:
<strong>
Include the result of program execution here:
<!--#include virtual="printalpha.cgi" -->
... done.
</strong>
Here is the output in the final document:
Include the result of program execution here: [an error occurred while processing this directive] ... done.
Here is an example of a program being invoked from our cgi-bin directory, without needing the .cgi suffix in its name. We will put the executable program printalpha.sh in our cgi-bin directory ~aftp/pub/ssidemo/cgi. Its normal cgi-bin URL will then be http://www.rahul.net/cgi-bin/ssidemo/printalpha.sh . Its pathname for use in server-side includes is its virtual path, which is /cgi-bin/ssidemo/printalpha.sh .
The lines in our document are:
<strong>
Include the result of program execution here:
<!--#include virtual="/cgi-bin/ssidemo/printalpha.sh" -->
... done.
</strong>
Here is the final output:
Include the result of program execution here: [an error occurred while processing this directive] ... done.
<!--#include virtual="/cgi-bin/ssidemo/myprog?arg1&arg2&arg3" -->
To a2i communications home page
$Id: index.shtml,v 1.8 1999/01/10 21:59:08 rdroot Exp $
$Source: /files/home/ftp/pub/ssidemo/www/RCS/index.shtml,v $