Get SSI running on IIS


Server Side Includes (SSI) are an optional feature of the web servers helping the developers to include HTML file content from a base file into multiple other HTML files with a single line of code. We need this if we are creating a simple, elegant and fast pure HTML site, without active server computing, just invoking content delivery capabilities of the server.

There are 3 major steps required to get SSI running on IIS 7 and later:

  • Configure IIS roles,
  • Extend IIS handlers,
  • Invoke a SSI call in you HTML code.

[1] To configure required IIS role features go to your 'Server Manager' (on a server machine) or 'Programs and Features' > 'Turn Windows features on or off' (on a common desktop machine). Find the IIS group and check 'CGI' and 'Server-Side Includes' to enable required features.

[2] Now the web server is SSI-enabled, but this will work only for the default file types with .stm, .shtm or .shtml extension. You will probably not like it, not willing your site visitors to browse to such weird file types.

To enable SSI for the well known .htm and .html files open 'IIS Manager', select you site, find and open 'Handler Mappings' feature and create module mapping entries, separately for .htm and .html, optionally restricting availability for only 'File or folder' requests:

[3] Above actions complete the setup. Now create a file like e.g. 'menu.ssi' (The .ssi extension is optional, but should be considered good practice). Put in this file only the partial html code for the menu, no , or like tags, e.g:

Call the .ssi content from within your other html files using one of following options, depending on how you menu.ssi file is deployed on the server:

Style it and have fun!


Back to List