Free Webmaster Help Logo
Tutorials Articles Tools Images Directory Ask Newsletter

Advanced HTML
Frames & Tables
Rounded Table Corners
Flash 5
Site Promotion
Mobile Internet: WML/WAP
Server Side Includes (SSI)
HTML - The Basics


Related Links
Free SSI Hosts
More Server Side Includes (SSI) Sites

Sitemap | Contact | Link To Us | Advertise
Report A Problem

Server Side Includes (SSI) Tutorial
Part 1 - Introduction & Including A File


Server Side Includes (SSI) are extremely useful, even though you may have never heard of them or known that you are experiancing them. SSI is a server side method of manipulating web pages which means that you do not need a specific browser to use them, and they will run on any computer.

You will never have noticed SSI before on a web page because nothing special appears, in fact the adverts at the bottom and side of this page are placed there using SSI. What SSI does is it tells the server to replace the SSI tag with something else, for example a piece of text. This is done when the page is requested and the user will see nothing different to if the text (or code) was already there (view the source of the page to see this).

Why Should I Use Them?

You are probably thinking that this seems a very strange way to include some text, or even some HTML code on your page. It seems like a bit of a waste of time when you could just enter it as you normally would. There are two great benefits of SSI, though. Firstly, you can get many pages to include the information from a single file so that you could, for example, include a standard footer on each page with your copyright information. You could then update all the pages by just changing this one page.

Secondally, you can get your SSI to execute a CGI script on your server. This allows you to have text counters, advanced advert rotations, random text and images and several other extras on your web pages. This is one of the best uses of SSI.

What Do I Need?

As I mentioned earlier, SSI tags are parsed server-side, not by the user's browser. This means that SSI must be set up on your server for them to work. You are unlikely to have SSI enabled if you do not have a CGI-BIN but if you do it is very likely that the server administrator will have enabled SSI.

To test whether SSI is set up on your server place the following code in an HTML page:

<!--#echo var="DATE_LOCAL"-->

Then try to run this page on the server. If SSI is enabled the current date and time on the server will be displayed. If this does not work try renaming the page extension to .shtml instead of .html or .htm. Many servers require this for SSI to work. If neither of these work, check the source code of your page. If the SSI tag is still there there is a problem. E-mail the system administrator and ask him if SSI is enabled.

If you do not have SSI on your server then you could try one of the free web hosts that support it like Virtual Avenue or Hypermart.

Including A File

This is one of the most simple things you can do using SSI. Create a text file with a little bit of text in it and save it. Upload it to your server. Then create an HTML file and add the following:

<!--#include virtual="myfile.txt" -->

The way in which this works is that the file is refered to relative to your accounts root. To explain this I will show what would happen if you had the file saved in a folder called 'common'. Your site is at

To include this file from any page on your site you would use:

<!--#include virtual="/common/myfile.txt" -->

This would be the same even if it was on the page or

An easy way to work out what the path would be is to take your domain name (or subdomain) off the file's name:

in this example. The obvious benefit of this is that you don't even have to keep updating the code on each page like you would with an image or a link.

Part 2

In part 2 I will show you some of the other ways to use SSI including using it with a script and displaying server information.

© 1999 - 2019