Server-Side Include

  • Allows an HTML page to include files from the server
  • Allows an HTML page to execute programs and insert the results.
<!--#include virtual="/footer.html"-->
<!--#include virtual="/cgi-bin/counter.cgi"-->
  • Can either use a relative path (relative to the current directory), or an absolute path (starting with "/")
  • Full URLs (http://...) aren't supported, even if the file is on the same server
  • Can't have an SSI in HTML code that's dynamically generated by JavaScript, because the JavaScript is run on the client side.

SHTML

  • Server-side-include HyperText Markup Language
  • .shtml is the file extension for web pages that contain server side includes (SSI).
  • The server has to be configured to support SSI.

Server-Side Include elements

<!--#element [attribute="value"]+-->
Attributes supported by Apache and IIS
  • config
  • echo
  • exec
  • fsize
  • flastmod: When a file was last modified
  • include
Attributes supported by Apache
  • printenv
  • set

Resources URL: 
notes/html/resources
Sources URL: 
notes/html/sources

See Also