SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Oct 2012
    Posts
    139
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    .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?

  2. #2
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,892
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Greg Baka View Post
    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?
    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).

  3. #3
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,411
    Mentioned
    273 Post(s)
    Tagged
    5 Thread(s)
    Off Topic:

    Quote Originally Posted by Stevie D View Post
    And there raged a bitter war between the Pro-L camp and the No-L camp (who tended to get distracted around Christmas) ...

  4. #4
    SitePoint Member
    Join Date
    Feb 2013
    Location
    India
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Greg Baka View Post
    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?
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •