What Is a Server Side Include (SSI)?

Server Side Includes are files that have some commonly used code that can be reused by many pages in your site. When you use a SSI file the server takes the entire content of the file and inserts it into the page, replacing the include code. As an example, imagine you have a large web site with links at the top, bottom, and sides common to all pages (or a section of pages). To make the site easy to maintain, you can have the header, footer, right and left navigation as include files. So when there is a change to be made you just need to make the changes, save and upload the corresponding include file and not the many files using it.

The decision of when to use SSI, and when to have your page entirely generated 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 is a great way to add small pieces of information, such as the header, footer, or left or right navigation.

To use the SSI, create a file w/ the extracted code then in your ASP or HTML template call the file w/ the following code.

<!–#include virtual=”/path_relative_to_site” –>

Note: Make sure to configure your web server so that it will process SSI code. To configure your server, see below.

Configure Web Server to Process SSI

  • By default, most web servers are not configured to process the include statements for an .html file
  • Change the default in the application settings configuration to parse .html (mime type) files for includes
  • Alternative: rename files and matching references to .shtml or .asp
  • Consult your web server support staff if you need assistance in this area


Submit a Comment