Indiana University

IU Webmaster

Server Side Includes

  • A server-side include is a coding that you can include within your HTML document that will tell the web server to include other information with the document being served.

  • Server side includes are a handy way to include information on your pages automatically. For example, you can use an #INCLUDE statement to display the header and footer of your pages automatically and make sure that each page displays the same information. You can save time by using a single header.html or footer.html file if this information changes. You can also use server side includes for graphics such as logos or image maps that should appear on multiple pages.

  • You will need to use the .shtml extension if your page includes Server Side Includes and is hosted on Veritas or Champion.

  • Please note that for security reasons, the EXEC server side include is NOT enabled on Veritas or Champion. The EXEC command is often used to run a cgi or perl program from a web page, but this function is not enabled on Veritas or Champion.

Using Server Side Include

To use a server side include, use the #include statement. This command tells the server to include another file, and tells it the file name that should be included:

<!--#include FILE="filename.html"--> 

This page uses server side includes to display the Webmaster banner and header information. An example of the command used is:

<!--#include file="header.html" -->
In this example it is placed in the body of the document, immediately after the <BODY> tag. One thing about SSI includes is the process of including. It takes two separate files and creates one whole file. What the server does is actually to take the SSI page and physically inserted it into the page calling it.

Using Server Side Includes with files located in different directories:

If the server-side include calls a file that is located in another directory in the account, you need to make some modifications. For example:

<!--#include virtual="../header.html" -->

In the above example, the file named "header.html" is located in the directory above the location of the file referencing it. Also, instead of using "#include file" you must use the command "#include virtual".


The footer for this page is created dynamically, so that the date that the file was last modified automatically appears in the footer. The server side include statement calls another .shtml file, using this code:

<!--#include file="footer.shtml"-->
The footer statement on this page is placed at the bottom of the file, just before the </BODY> tag.

Here's an example of our footer file, footer.shtml:

Last Modified: 09 January 2004
Comments: Contact the IU Webmaster
Copyright 1999-2004, The Trustees of Indiana University

This is the code for the footer.shtml file:

&lt;center&gt; &lt;HR WIDTH="70%"&gt; &lt;FONT size=-1&gt; Last Modified: 04 April 2007&lt;br&gt; URL:;BR&gt; Comments: Contact the &lt;A HREF=""&gt;IU Webmaster&lt;/A&gt;&lt;BR&gt; &lt;A HREF=""&gt;Copyright&lt;/A&gt; 1999-2004, The Trustees of &lt;A HREF=""&gt;Indiana University&lt;/A&gt; &lt;/FONT&gt; &lt;HR WIDTH="70%"&gt; &lt;/CENTER&gt;

For more information on how to use SSI on Veritas or Champion, please see our SSI Tutorial Document.