Skip to Content


server side includes

What are Server-Side Includes?

Server Side Include (SSI) is a feature of CGI (in conjunction with your server) that allows you to dynamically insert a piece of information including the current date, any HTML file, and execute CGI/PERL scripts in your web page. The browser displays the SSI code as if it was hard coded onto that page.

SSI is enabled by default on all .html files.
If you want SSI enabled on pages with a different extensions (like .htm and .html), you can create an .htaccess and put the following three lines in it, then upload it:
<FILES*.htm*>
SetHandler server-parsed
</FILES>

How can I use SSI on my web pages?

To display the current date and time:
  1. Add the following SSI code to your web page:
    • <!--#echo var="DATE_LOCAL" -->
  2. Save your web page with the extension .html
    • The result is: Friday, 19-Apr-2024 13:52:26 PDT
To display the last modified date of a web page:
  1. Add the following SSI code to your web page:
    • <!--#flastmod file="web_page_name.html" -->
  2. Save your web page with the extension .html
    • The result is: Sunday, 13-Aug-2023 06:53:28 PDT
    • (We used the following code because this page is called index.html)
    • <!--#flastmod file="index.html" -->
To include a document inside another:
  1. Add the following SSI code anywhere on your web page: (The included file doesn't have to be a ".htm" file. It can also be a ".txt" file (ie: myfile.txt).)
    • <!--#include file="myfile.htm"-->
  2. Save your web page with the extension .html
To execute a CGI script or command directly from a web page:
  1. Add the following SSI code to your web page: (Of course, you'll need to change "myscript.cgi" to the script you're trying to call.)
    • <!--#exec cgi="/cgi-bin/myscript.cgi"-->
  2. Save your web page with the extension .html

To include the results of a CGI script in a web page:
  1. Add the following SSI code to your web page: (Of course, you'll need to change "myscript.cgi" to the script you're trying to call.)
    • <!--#include virtual="http://www.yourdomain.com/cgi-bin/myscript.cgi" -->
  2. Save your web page with the extension .html