Personal tools
You are here: Home All Locations ASET Web FAQ 6.02. How do I use Server Side...

Web FAQ 6.02. How do I use Server Side Includes (SSI)?

Document Actions

    Server-side includes (SSI) are particularly useful if you would like to put the same information in each of your Web pages. One technique that some people use to maintain a consistent "look" throughout their Web pages is to have the same header (for instance, the background color or texture or perhaps a menu image map) and the same footer (for instance your e-mail and a modification date) on every page.

 Server-side includes appear as comments in the HTML file. These comments are in the following form:

     <!--#command tags="value"-->

To include text inside another HTML file, one adds:

     <!--#include file="myfile.html"-->

In addition to file="myfile.html", you can use virtual="virtualpath/file.html" to designate a path relative to the server root. For virtualpath use /users/a/b/abc123 as the path if you are trying to access a file from user abc123's Personal Web space. IMPORTANT: In order to use server-side includes, you have to make sure that the file extension in which you put the server-side include tags is set to be parsed by the server. One way to do this is to insert the following line in your .htaccess file:

     AddType text/x-server-parsed-html .html

Note: By using SSH, you can follow the menu path "View ->Show Hidden Files" to display all hidden files in your home directory and check if you have ".htaccess". If you don't have an existing ".htaccess", you can create one by yourself by using a text editor such as Notepad (Windows) or SimpleText (Macintosh). For details on how to create and use ".htaccess", please check this reference link: http://apache-server.com/tutorials/ATusing-htaccess.html

A second and more convenient way is to simply give the file a .shtml extension instead of a .html extension.

Additionally, if your include file contains SSI, make sure that this file is also set to be parsed by the server.

For help contact The ITS Help Desk
Also Search the ITS Site Index
Last modified 07-18-2007