SSI (Server-Side Includes)

Server-Side Includes (SSI) let you insert external files into a page, print system variables, and show results from CGI scripts. For example, instead of writing 30 lines of menu code on every page, you can use a single SSI directive on each page to display the same menu.

To use SSI, the page must have the file extension .shtml.

Insert a text file

Use the following code to insert an external text file located in the same directory.

<html>
<head><title>SSI test 1</title></head>
<body>
<!--#include file="insert.txt"-->
</body>
</html>

Use the following code to print information from the system, such as the date, time and the visitor’s IP address.

<html>
<head><title>SSI test 2</title></head>
<body>
<!--#echo var="DATE_LOCAL"-->
<!--#echo var="REMOTE_ADDR"-->
</body>
</html>

Show results from a CGI script

Use the following code to display results from a CGI script. This can be useful, for example, for a visitor counter.

<html>
<head><title>SSI test 3</title></head>
<body>
<!--#exec cgi="/cgi-bin/count.cgi"-->
</body>
</html>

Our support does not cover script-related problems unless they are caused by one of our servers, and we are unable to assist with your programming.

If you have a problem with a script and want us to take a look, please send us the path to the script, a brief explanation of what you are trying to do and any error messages you receive.

Was this article helpful?

Related Articles