dark mode light mode Search Menu
Search

File Extensions

The file extension displayed in your web browser can reveal the software language used to build then deliver your web page.

What's a file extension? It's a clue used by a web server to decide what language to use to process a web page request. For example, the file extension .html or .htm is the most basic file extension. Typically these web pages are stored as static files on the web server instead of created dynamically on the fly when a page is requested by a web browser. These HTML pages are self-contained.

Here are a couple examples of website URL so you can see what I mean by file extensions. The first is from the New York Times and, apparently, their web pages are static HTML pages:

notebook-file-extensions-with-ext
A Website URL with the .html File Extension for Pages

The important bit is the .html file extension added to the malaysia-airlines-flight-370.html file name.

Here is a more modern website URL where the file extension is removed:

notebook-file-extensions-no-ext
A Website URL with No File Extension for Pages

Notice there is no file extension added to the items-i-love file name.

Removing file extensions is considered better than using a file extension. The primary reason is portability. If you change your website publishing software, and it uses a different programming language, you likely will not have to change all your web page URLs. The New York Times, for example, likely would have to change all their .html pages to remove the file extension.

People also like to distinguish between web content that is meant to be downloaded on to a computer (where a file extension may matter) and content displayed in a web browser (where a file extension really does not matter because the server is configured).

Personally, the more important bit about URLs is less the file extension and more the file name. In both the examples above, you can tell what the page is about because the file names describe the content. Clearly the Times story is about the missing airplane from Malaysia and the Etsy story is about stuff SeffyGHops loves. Writing code to redirect or strip off file names is somewhat trivial compared to renaming all the file names for your content.

Here are the most common file extensions you can see on the internet. While not as exciting as looking for license plates from different places when you’re stuck in the back seat of a car on a road trip, spotting some online of these could be fun.

File Extension(s) Language
.asp Active Server Pages (ASP) Classic
.aspx, .axd, .asx, .asmx, .ashx ASP.NET
.cfm ColdFusion
.yaws Erlang
.htm, .html, .xhtml, .shtml, .jhtml HyperText Markup Language (HTML)
.jsp, .jspx, .wss, .do, .action Java
.pl Perl
.php, .php4, .php3, .phtml PHP: Hypertext Preprocessor
.py Python
.rb, .rhtml Ruby
.rss, .xml Extended Markup Language (XML)
.cgi, .dll, .fcgi Common Gateway Interface (CGI), Dynamic Link Library (DLL), and Fast CGI. Usually written in C or Perl but could be other languages.

 

Of course, there are many file extensions used in computing. These are only the most common website URL file extensions you will see online.

You also might notice some of these file extensions use three characters instead of four, .htm instead of .html. Likely the three-character extensions are on Windows servers which use tightly defined rules for the length of file extensions. And you might notice the .shtml extension which, while it appears to be a static HTML page, actually is built from files called server-side include files; for example, the top and bottom of the web page might each be in one file yet included on every page of a website.

There also are fake file extensions you might see, extensions created by one person to work on their web server. Someone might like The Flintstones, for example, and rename all their PHP scripts with a .fred file extension. Then configure their server to process pages with the .fred file extension with the PHP modules on the web server. Instead of my-favorite-page.php, you would see my-favorite-page.fred in the top of your web browser URL bar.

Learn More

Website URL File Extensions

http://stackoverflow.com/questions/1614520/what-are-common-file-extensions-for-web-programming-languages

A List of File Formats and Extensions

http://en.wikipedia.org/wiki/List_of_file_formats
http://www.fileinfo.com/filetypes/web

File Naming Guidelines

http://duckdigital.com/DAM/?p=23
http://wac.osu.edu/tutorials/bestpractices/organize.htm

To Use File Extensions, Or Not To Use Them

http://stackoverflow.com/questions/3631153/how-come-some-site-urls-do-not-include-a-file-extension

Related Posts