Indiana State University   OIT/Web Development


Server-Side Includes


This page provides instructions on how to use server-side includes in your web documents. Server side includes (SSI) can help you control the look of a large web site. IT User Services use SSI's on its public information pages to ensure that the end of each document contains the same navigation bar.  Because we use server side includes for the navigation bar, when it needs to  be updated, we only need to change 1 file.

When a browser such as Netscape requests a web page with a server side include command, the web server adds the file specified in the SSI command into the web document being served.  It is then displayed as one document on the browser.

If you wish to use SSI's, please note that you need to be familiar with HTML codes and Unix.  Most web editors do not have a feature for adding SSI's.    After you create your page you will need to add the SSI commands by editing the HTML code through a text editor.

Please refrain from using server-side includes in your documents if at all possible. They can result in performance penalties when the NCSA HTTPD server is heavily loaded. 


Web Page Setup

To use server-side includes in your web documents you must do two things:

  1. The server-side include tag needs to be placed in the document at the appropriate location. Remember, server-side includes instruct the server to include information in the document "on-the-fly". In other words, at the point where the server-side include is tagged.
  2. The execution bit of the HTML document containing the server-side include needs to be set for the owner of the document. If the execution bit of the document is not set accordingly, the server will not parse and execute the server-side include tag.  To set the execution bit on your web document issue the following command from the telnet prompt:

    chmod u+x filename.html

Simple Example

The following lines illustrate how server-side include tags may be used in your web documents:
 

<p>Last Modified: <!--#echo var="LAST_MODIFIED"--></em>
<!--#include virtual="/IT/user-serv/footerinclude.html"-->
 

This code adds a last modified date to the document and then appends the file /IT/user-serv/footerinclude.html to the document.

More information about Server Side includes is available at Mark West's Server Side Includes page.  Please note that on web.indstate.edu and isu.indstate.edu .htaccess and the .shtml extension is not needed.  Please refer to this page only for instructions on using server side includes commands in your web documents.

 

 

This page is maintained by web@indstate.edu