Search anything:

What is SHTML?

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

SHTML is a file extension (.shtml) that denotes that the current file is an HTML document (.html) with an extra feature known as Server Side Includes. This was a widely used feature in early 2010s.

In short:

SHTML = Server Side Includes + HTML

When is SHTML used?

SHTML is used when:

  • The HTML page needs to run a server side script.
  • The HTML page customizes itself
  • When HTML page needs to optimize and reuse code by including common code components once across various files.

Today, the use of SHTML has gone down significantly due to the rise of security concerns and better alternatives using sending the rendered HTML page directly. Legacy websites still use SHTML.

What is Server Side Includes?

Server Side Include (SSI) is an extension of HTML that allows a developer to execute a script on the server and send information back to the HTML page.

Server Side Includes (SSI) for running server side code looks like this:

<!--#exec cmd="bin/script.cgi" -->
<insert file="bin/script.cgi">
<!--#echo var="DATA" -->

In this above HTML code snippet, we are executing a script on the server and retrieving information to be used for making the rendered HTML page custom.

Directly executing a script on the server results in security issues so an alternative to the first code line is:

<!--#include virtual="/bin/script.cgi" -->

Server Side Includes (SSI) for including header files for HTML looks like this:

 #include ifheader="common-page" file="opengenus.html" else="opengenus-2.html" 


Following table summarizes the differences between SHTML and HTML:

File extension.html.shtml
Supports Server Side IncludeNoYes

With this article at OpenGenus, you must have the complete idea of what is meant by SHTML.

What is SHTML?
Share this