Skip to content

Using Server-Side Includes

Server‑Side Includes (SSI) allow you to embed dynamic content into your web pages. On ruachost.com, SSI is supported on Apache servers and can be enabled through .htaccess directives or by using .shtml files.

  • Reuse common HTML code (headers, footers, menus).
  • Display dynamic information (last modified date, environment variables).
  • Add conditional logic to web pages.
  • Simplify site maintenance by centralizing shared content.
  • By default, SSI is enabled for files ending in .shtml.
  • Rename your HTML file to .shtml and insert SSI directives.

Method 2: Enable SSI for .html or .htm Files

Section titled “Method 2: Enable SSI for .html or .htm Files”

Add the following to your .htaccess file:

Options +Includes
AddType text/html .html
AddOutputFilter INCLUDES .html
AddType text/html .htm
AddOutputFilter INCLUDES .htm
<p><em>Page last modified on <!--#echo var="LAST_MODIFIED" --></em></p>
<!--#include virtual="footer.html" -->
<!--#if expr="$DATE_LOCAL = /^Saturday/ || $DATE_LOCAL = /^Sunday/" -->
<p>It's the weekend!</p>
<!--#else -->
<p>It's not the weekend...</p>
<!--#endif -->