How to use Server Side Includes

Server Side Includes (SSI) is a server-side scripting language which runs on Apache (with mod_ssi), some Java Application Servers (see Server Side Include in GlassFish) and also on Microsoft Internet Information Services (IIS). Here are a few examples of how to use SSI:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Server Side Includes</title>
    <style type="text/css">
      * { margin: 0; padding: 0; border: 0; }
    </style>
  </head>
  <body>  
    <!-- http://httpd.apache.org/docs/2.0/howto/ssi.html -->
 
    <!--#set var="name" value="Benny Neugebauer" --> 
    <!--#set var="text" value="My name is ${name}." --> 
    <!--#set var="accountBalance" value="\$72.72" --> 
 
    <p>
      <!--#echo var="name" --><br/>
      <!--#echo var="text" --><br/>
      My account balance is: <!--#echo var="accountBalance" -->
      <br/><br/>
      <!--#if expr="${name} == 'Benny Neugebauer'" -->
      <b>Hey Benny!</b>
      <!--#else -->
      <em>Who are you??</em>
      <!--#endif --> 
      <br/>
      <!--#if expr="{$name} = /[a-zA-Z]/" -->
      Your name contains just letters. Yay!
      <!--#endif -->
      <br/><br/>
    </p>
 
    <p>
      <!-- Print some CGI variables... -->
      <!--#echo var="HTTP_USER_AGENT" --><br/>
      <!--#echo var="SERVER_NAME" --><br/>
      <!--#echo var="REMOTE_ADDR" --><br/>
    </p>
  </body>
</html>