File Extensions

You can tell a bit about the software used to create the web page you're reading by looking at the URL in your web browser.

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

Author

  • Tim Slavin

    Tim is an award-winning writer and technologist who enjoys teaching tech to non-technical people. He has many years experience with web sites and applications in business, technical, and creative roles. He and his wife have two kids, now teenagers, who are mad about video games.

Also In The April 2014 Issue

How to Make a Twitter Bot

There are a ton of ways to make a Twitter bot. Here are a number of resources, ideas, and clues to follow up.

What is an Algorithm?

Algorithms control our lives online and offline. Here are some examples to show what is an algorithm and how they work.

How to Build Example Bot

I have updated the installation instructions for this Github project to make it even easier to install and play with.

Bot Makers

A collection of bot makers and professor types attend an online bot convention to talk about Twitter bots and more.

File Extensions

You can tell a bit about the software used to create the web page you're reading by looking at the URL in your web browser.

Traceroute

A computer command used to diagnose network problems also lets you see how data hops across the internet.

How to Build a Slightly Complicated Website

Some tips on how to find online publishing services and use them to create your website.

What is an API?

APIs can be a fun, easy to use, and easy to learn way to retrieve and mash up data online.

April 2014 News Wire

Interesting stories about computer science, software programming, and technology for the month of March 2014.

Objects

Many programming languages organize their code into objects, to model their applications and make their code more reusable.

April 2014 Learn More Links

Links from the bottom of all the April 2014 articles, collected in one place for you to print, share, or bookmark.

At bottom, robotics is about us. It is the discipline of emulating our lives, of wondering how we work.

Interested but not ready to subscribe? Sign-up for our free monthly email newsletter with curated site content and a new issue email announcement that we send every two months.

No, thanks!