↩ Advanced Users

Using Server Side Includes

Server Side Includes (often called simply "SSI") are Apache directives that allow the inclusion of other pages and content into a regular HTML page.

The most common use of SSI is to include for example a menu across several pages in your website. Rather than typing the menu code into each HTML file, you would simply create a single HTML file with the menu code and "include" it in the others with the use of a single command.

Example commands:

To include a file called "footer.html":
<!--include virtual="/footer.html" -->

To include the date the document was last modified:
<!--#config timefmt="%A %B %d, %Y" -->

To include today's date:
<!--#echo var="DATE_LOCAL" -->

Usage:

To enable SSI on any page in your website, you must do one of two things.

1) Ensure the commands are in a file with ".shtml" extension, for example "index.shtml"

OR

2) Adding the following line to a file called ".htaccess" in your public_html directory will tell the server to enable SSI in ".htm" and ".html" files:

AddHandler server-parsed .html .htm

For more information on the use of SSI, please see the official Apache docs.