.html ~vs~ .htm?

Why are both .html AND .htm used?

Should a website have important pages (like the Home or index page) with both .html and .htm ?

Or is .htm just for special types of pages?

[font=verdana]The reason we ended up with both is historical. Back in the days before Windows 95, filenames were limited to an 8.3 format (ie 8 character filename plus 3 character extension). So HTML files used the .htm extension. Then Windows 95 did come along and quickly eclipsed the suddenly prehistoric-looking 3.x versions, and we were no longer restricted to 8.3 filenames. While extensions generally did remain as 3 digits (until the arrival of Office 2007) there was no reason why they had to, and certain filetypes like .js went their own way … so people started to say “Hey, why are we abbreviating HTML? It’s already an abbreviation! The world’s moved on, we can have more than three characters in the file extension!”. And lo, the .html extension was born. And there raged a bitter war between the Pro-L camp and the No-L camp (who tended to get distracted around Christmas) until the web fractured into DHTML, SHTML, PHP and everything else, and the Pro-Ls and No-Ls finally made up their differences and agreed to live side-by-side in harmony.

OK, I may have got some of the detail wrong, but that’s the essence of it.

There’s no need to have both extensions. If someone types in example.com/, the server will look for various combinations of “index”, “home”, “.htm”, “.html”, “.php” and others until it finds a file that matches one of them. (Of course, that only works for the index page in each folder, and wouldn’t work for other pages). Unless you notice 404 hits in your server logs that show people have been trying to hit on the ‘wrong’ file extension, there’s nothing to worry about. If people have been doing that, the easiest solution is a simple Rewrite rule that will work on all files, rather than specifying individual ones.

Of course, best of all is to set Options +Multiviews and then the server will automatically add the extension on. So if you ask for example.com/widget, it will first of all try example.com/widget/index.htm (or .html etc) as normal, and if that isn’t there it will also try example.com/widget.htm (or .html etc).[/font]



Both .htm and .html are accurately the similar and will work in the same way. The choice is down to personal preference; provided that you’re reliable with your file naming you won’t have a problem with either.