Server Side Includes (SSI) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or some other dynamic technology.
The decision of when to use SSI, and when to have your page generated completely by some program, is usually a matter of how much of the page is static, and how much needs to be recalculated every time the page is served.
SSI lets you embed a number of special 'commands' into the HTML itself. When the server reads an SSI document, it looks for these commands and performs the necessary action. For example, there is an SSI command that inserts the document's last modification time. When the server reads a file with this command, it replaces the command with the appropriate time.
By default, a file containing server-side includes must have a .shtml
file extension; however, if you need to process server-side includes in pages with an .html
file extension, email us at firstname.lastname@example.org
and we can enable it on your account.
One common use of server-side includes would be to implement a consistent site menu that can be included in every page on your site and updated by editing just one file. This can be done by creating an HTML file with your menu include (we'll assume you save it as menu.shtml), like this:
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
<li><a href="#">Link 5</a></li>
Then, you would include this HTML fragment in each of your pages by placing the following SSI call where you want your menu to appear:
Any updates to the menu.shtml file would be reflected in all pages containing this include.
For a list of other server-side includes, please visit: