HTML Writers Guild Resources FAQs shtml FYI FAQ

.shtml/.html/.htm File Extensions For Your Information

Table of Contents

  1. An Overview of File Extensions
  2. .htm as a 3 letter version of .html
  3. The default file for a URL
  4. .shtml File Extensions
    • Server Side Includes and Performance Considerations
    • Alternatives to the .shtml extension
    • Two more server related file extensions
  5. Summary of File Extensions
  6. For Further Information

  1. An Overview of File Extensions

    Just as most systems have applications that recognize .txt files as "text" files, .gif files as graphical files, and so on, the .htm, .html and .shtml are file extensions that tell various applications what kind of files these are. These include both client-side applications (browsers like Netscape, Microsoft Explorer, Mosaic, etc.) and server-side applications (the servers that decide what to do when someone links to your URL).

  2. .htm as a 3 letter version of .html

    The primary difference between .htm and .html is simply that .html can't be represented in a DOS/16 bit operating system which uses the 8.3 file naming convention. So, .html files were renamed .htm when they were written on DOS/Windows 3.x systems.

    Most servers (but not all) that can handle 4 character file extensions can be set up to treat .htm and .html files exactly the same, just as they can be set up to treat .jpg and .jpeg files the same.

    Table of Contents

  3. The default file for a URL

    Your Webmaster decides what the default file is, but it's usually index.htm OR index.html. For security/utility/convenience reasons though, many sites are configured to look for one specific file name as the "primary" file in a Web directory. This is the file that the server displays first when someone links to your URL. If it requires a specific file name, this is usually either index.htm OR index.html (but not both). If you're stuck with one 'primary file' in a Web directory, many webmasters tend to pick that extension and stick with it as the html naming convention for their site. (The early version of the Netscape Server (not browser) on Windows NT was one of those which required you to pick one file name as "default.")

    Once upon a time, there was even, Heaven help us, a "recommended" file extension of .html3 and .ht3 for HTML 3.0 files, to distinguish them from .html 2.0. Fortunately this fell by the wayside, when people realized they could get exactly the same information from either the HTTP header or the DOCTYPE within the document, but if you see any references to this, you'll know what it's for.

    Table of Contents

  4. .shtml extensions.
    • Server Side Includes and Performance Considerations: Why the .shtml extension is used

      If an html document contains "Server Side Includes" that means that it includes special commands for the Server to process. This is normally how things like counters are done on basic web pages.

      On some websites, the webmaster sets up the server to parse, or read through every .html or .htm file to see if it contains server instructions. However, this WILL slow things down when people link to the pages.

      So, many webmasters have instituted the .shtml files. This is simply a naming convention that says "This html file includes Server commands - please parse it before delivering to the browser site" (hence the "s"). That way parsing can be skipped for all "plain" .html [or .htm] files.

    • Alternatives to the .shtml extension

      It doesn't have to have "shtml" - that's just the most commonly-used convention. But if it's used, it's used because your webmaster decided that that was the one they would pick. And if they did pick it, they may or may not have set up your server so that it would look for a default file of EITHER "index.shtml" or "index.html" (Some servers, as mentioned, can't have more than one file name as a default, and some webmasters don't think of doing this, which can complicate your Welcome page if you want to use server-side includes). Some other names you may see are .phtml (for Parsed HTML) and even .chtml (for Command HTML). Again, it's up to the webmaster, but .shtml is pretty standard these days. Microsoft's Internet Information Server (IIS) uses .ssi as a three character extension for .shtml file.

    • Two More Server-Related File Extensions: .cgi and .asp

      CGI stands for Common Gateway Interface. CGI files cause events to happen on the Server, normally through executing programs written in PERL, C, C++, or other programming languages. This is often used for things like database access, creation of customized HTML files, forms processing, and so on. Many CGI files use a .cgi extension, which can be set up to tell the Server that special handling or permissions are required for the file. You will not normally have a .cgi file as your default file in a directory, but if you do, you may run into the same kinds of issues as you do with .shtml files.

      With the introduction of ActiveX, Microsoft has also introduced a new kind of server side file, Active Server Pages. These pages provide Server side ActiveX processing. These can perform many of the same functions as .cgi scripts, but are integrated into the ActiveX environment for Servers like IIS which support ActiveX. These files use the extension .asp. On some sites, again, depending on what the webmaster wants to do, HTML files which are generated from ActiveX scripts, or even HTML files which simply call ActiveX scripts, may also use the .asp extension. As with CGI, this becomes particularly important to you when you want to use a .asp file as the default file in your directory, and you may have to discuss the issue with your Webmaster.

    Table of Contents

  5. Summary of File Extensions & Practices
    1. .htm is .html for systems which only allow 3 character file extensions.
    2. .shtml is a commonly-used convention for an .html file that includes Server instructions.
    3. .ssi is .shtml for systems which only allow 3 character file extensions.
    4. Most servers can be set up to recognize either .htm or .html extensions as html files, but many sites pick one as a convention and stick with it.
    5. Most servers have a default name for each url, most commonly "index.html," but this is up to the webmaster of each site.
    6. Webmasters who are concerned about server performance commonly use the .shtml extension for an .html file that must be parsed. However, it's not necessary to do so; you can set up most servers to parse all .html files or all files with some other extension that the webmaster picks.
    7. .cgi is often used to indicate a Common Gateway Interface file which will perform Server Side processing.
    8. .asp is a Microsoft file extension for Active Server Pages. .asp files normally run on an ActiveX server, but some Webmasters use them for other HTML files with ActiveX associations.
    9. If the .shtml extension is used, check with your webmaster to see if you can name the default file for your url as "index.shtml" - if not, how does your webmaster want you to indicate that your default file includes Server instructions?
    10. If you want to use a .asp or .cgi file as the default file for your url, again, you will need to check with your webmaster to see if your server will handle these correctly.

  6. For Further Information

    For an EXCELLENT online tutorial on this subject, see: Matt Kruse's Server Side Include Tutorial

    Table of Contents


[Valid HTML 4.0!]
This page is maintained by faqs@hwg.org. Last updated on 19 February 1999.
Copyright © 1998 by the HTML Writers Guild, Inc.