Knowledgebase: SSI


How to use SSI?
The simplest example of server-parsed HTML is to have a file "foo.shtml" containing this text

Line one<br>
<!--#exec cgi="mycgi.cgi" --><br>
Line three

And then have a file "mycgi.cgi" that contains, on Unix:

#!/usr/local/bin/perl
print "Content-Type: text/html\n\n";
print "Line Two\n";

And when you access "foo.shtml", it will output:

Line one
Line two
Line three

If your @include directive is <!--#exec cgi="..." -->, then the cgi program you run must output a standard CGI header (Content-type: text/html)

Any file named foo.shtml will be parsed automatically by Apache on our servers.

Do not put any spaces before the '#' character in your @include directives; if you have "<!-- #exec" instead of "<!--#exec", the line will be ignored.

Server-side @includes in "custom trailers" will not work, since custom trailers are appended to the output of your web pages after all other processing has been done on them. Any server-side @includes that you put into your custom trailers will be sent directly to the browser without being parsed.

More Help for using SSI can be found at:
http://hoohoo.ncsa.uiuc.edu/docs/tutorials/@includes.html

[ Back to Top ]


What guidelines should I follow with SSI?
A couple of important points you need to follow for SSI to work on your domain.

1 - The web page that adds the SSI instruction to @include another page or program MUST end with .shtml or .sht rather than .html or .htm.

2 - The URL to the page you want to insert must be relative to the current web page rather than a full URL.

The SSI feature on your domain is limited to what is known as a "exec cgi command". This simply means that you can insert into any page the ability to execute any cgi program. The format for a Server Side @include is:

One quick observation... do you notice how this SSI instruction uses a *relative* URL (/cgi-bin/....) instead of a FULL URL? This is very important to keep in mind when using SSI.

For example, let's say we want to @include a counter program (that has the name, counter.cgi) on our home page, called normally index.html. Remember! Because we want to add a SSI instruction in our home page, it must end with .shtml or .sht. In this case, we would name it index.shtml.

[ Back to Top ]


What is a good SSI test program?
A simple SSI program to test if SSIs are set up to work on someone's domain or server:

<HTML>
<Head><Title>I was modified</Title></Head>
<Body>
<H1>I was modified</H1>
<P>I was last modified on
<!--#echo var="LAST_MODIFIED" -->
</P>
</Body>
</HMTL>

Save this as something like test.shtml in problemdomain.com-www and call it from a browser. If LAST_MODIFIED is replaced by the file creation date and time, SSIs work.

Source: "Server Side @includes" by Reuven M. Lerner (Linux Journal, June 1998).

[ Back to Top ]


What SSI is not allowed?
SSI that is not allowed: EXEC CMD
This is for security reasons and there are no exceptions.

[ Back to Top ]


Can I modify my .htaccess file so I can have SSI in a file ending with .html or .shtml?
This is highly discouraged as it will cause your site to run extremely slow. If you need this contact support for help.

[ Back to Top ]


What is the correct path to use SSI on the Burningbulb serversl?
T he path will always be relative to the URL location, not the server path. Therefore it should always be something like: /cgi-bin/test.cgi

and not: /home/username/domainname-www/cgi-bin/test.cgi

[ Back to Top ]


© 2003 Burningbulb.net