header left image   header right image

Home > Publishing Help > Creating Pages > SSI

Server Side Includes

Any site with more than three pages that has any content which is repeated through multiple pages should be using Server Side Includes (SSI). A SSI is a file containing that repeated content and each page that uses it would simply point to that file.

The major benefit of SSI is that if this repeated content needs to change, you won't need to go through all the pages to change it, only one file.

For example, this page uses three SSIs, the header, the navigation buttons to the left and the footer at the bottom of the page. To show how these are separate files, click on any of the following links:
navbar.html
header.html
footer.html

The way these files get inserted is by using the following text where you want the content to appear:

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

That line is in the source code where the navigation buttons should appear. When the server reads that line, it finds the file named navbar.html and replaces the single line with the entire contents of the file.

Frequently, SSI will have the extension .ssi. This is not required. Also, do not put <html> or <body> tags into your include file. Only put in the file what you want literally included into your web page.

One more step exists to make SSIs a success. The server needs to be informed that the web page contains SSI. This can be achieved one of two ways. The first is to give the page a .shtml extension instead of .html.

The second way is to create a .htaccess file and put this file in your web directory. A tool has been created for you to generate this file. .htaccess Tool Scroll down to "Server-parse .html and .htm files; cache period:", check the box and enter a 0 in the text field. Click the "Generate .htaccess File" button, copy the result into a text file, name the file ".htaccess" (make sure there is no extension on this file and the first character is a period. Upload this file into the same directory containing web pages with the SSI.

Other variables

You can also use some Apache server variables in your web pages. Examples are seen below.

Description HTML code Server Parsed
Local Date <!--#echo var="DATE_LOCAL"--> Wednesday, 08-May-2002 09:47:08 EDT
Last Modified <!--#echo var="LAST_MODIFIED"--> Tuesday, 07-May-2002 11:00:30 EDT
Name of Document <!--#echo var="DOCUMENT_NAME"--> local.shtml
URI to Document <!--#echo var="DOCUMENT_URI"--> /webmaster/webpublishing/local.shtml
Request Method <!--#echo var="REQUEST_METHOD"--> GET

 

[Toolkit]   [ Publishing Help]   [Publisher Forum]   [Web Policies]  [Web Security]   [Brown Home]   [CIS Home]   [Home]


Page Last Modified: Thursday, 27-May-2004 11:27:12 EDT by CIS