SSI (Server Side Includes) enables you to add dynamically generated content to an existing HTML page.
Usually HTML pages contain HTML code and content that does not change. SSI enables you to dynamically generate small pieces of the HTML page’s content.
The web server distinguishes parts of the HTML page which need to be dynamically generated through the SSI tags embedded in the page.
E.g. on the webpage:
<!DOCTYPE html>
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
</p>The requested URL <!--#echo var="REQUEST_URI" --> was not found on this server.</p>
</body></html>
<!–#echo var=”REQUEST_URI” –> is an SSI tag that will be replaced with the URL requested by the web client.
SSI tags enable different data to be displayed such as the date when the file was last modified.
This document last modified <!--#flastmod file="thisfile.shtml" -->
Or embedding the results from a CGI program:
<!--#include virtual="/file.php" -->
SSI supports setup and use of variables. For displaying the last modification of a certain file, you can use the variable $LAST_MODIFIED.
<!--#set var="modified" value="$LAST_MODIFIED" -->
Then to echo and display the content of the variable=modified you can use:
<!--#config timefmt="%D" -->
This file last modified <!--#echo var="modified" -->
#config timefmt=”%D” – sets the date format;
The web server will scan for tags only HTML files with a .shtml extension.
SSI tags are always processed before the HTML page is sent to the web browser.
SSI enables you to add dynamically generated content to an existing HTML page, without having to generate the whole page via a CGI program or another dynamic technology.