Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

Is it ".html" or ".htm", and when do I need a trailing '/' when typing a URL into my browser?

Question:

Is it necessary for some sites (& for me when going to them) to
put a / at the end of their address? Life is hard enough!

I’m going to expand on your question a little, because it actually
opens up a small can of worms … a small, but confusing can of
worms.

You see, the answer is “yes”, “no”, “sometimes” and “usually
not”.

There’s an amazing lack of consistency.

]]>

Let’s start with the “/”. The question boils down to this: is

http://ask-leo.com

the same as

http://ask-leo.com/
“In most cases they’re they same.”

and if not, which should you use?

In most cases, they’re the same. And by most cases, I’d say 99.99% of the time. You may find that once you get there the “/” has been added automatically, but that doesn’t really matter. Either approach works.

I’ll even go so far as to say that either should always work.

Most of the time.

The problem, of course, is that it’s quite possible for a web site to be ultra-picky and require one or the other, or behave differently between the two. I’d consider it a misconfiguration, but it’s possible. And which one you want will depend on how that server’s been (mis)configured.

In many ways, it’s the same as the old “www.” or not argument. You’ll note that both

http://www.ask-leo.com

and

http://ask-leo.com

take you to the same place. There’s actually no requirement that they do so. “www.” could be a completely different web site, though convention is to treat it as synonymous as the non-www version. I’ve definitely seen websites that fail to implement one or the other. That, once again, is a misconfiguration in my opinion.

And once again, which one you need depends on how that site was (mis)configured.

The part that I added on to your question is the “.html” versus “.htm” debate, since it too is something that site implementers choose and that the rest of us (visitors) then have to use and live with – and be confused by.

“.htm” and “.html” are both HTML (HyperText Markup Language) files. Web pages. They are the same thing, but with different names. And a web site that uses “.htm” likely will not respond to “.html”, and vice versa. It’s somewhat like identical twins who look a like and act alike but have different names and stubbornly insist that you call them by their correct names before they will react.

“.html” is the older, and more descriptive of the two. “.htm” comes from a time when web servers were being implemented in Windows, where extensions – the filename after the last dot – were limited to three characters in length.

The good news is that most of the time you need not know or care. You’ll go to a site, say http://ask-leo.com, and navigate by clicking on links, or saving bookmarks or copy/pasting URLS without ever typing one in or even noticing whether or not I use “.htm” or “.html” (or, as I do in some cases, something else entirely).

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

4 comments on “Is it ".html" or ".htm", and when do I need a trailing '/' when typing a URL into my browser?”

  1. If *.html and *.htm are the same what about graphic files labelled as *.jpg and *.jpeg? I have graphic files with both these extensions.

    Yes, .jpg and .jpeg are usually the same thing.

    – Leo
    29-May-2009
    Reply
  2. On many sites, if you typed .htm and the file has .html, the server will give you the correct page back (or vice versa)- unless there was both a .htm and a .html with the same name of course!

    I know that my server certainly does (For tech heads out there, it’s Apache 1.3 – and it uses a server code of 301 (Moved Permanently) to implement the change automatically as far as the end-user is concerned)

    As Leo says, it’s all in how the site’s server has been configured.

    Reply
  3. I look after several websites, some of which were written over 5 years ago. The older pages have the “.html” extension, and the newer pages that I have created (using Expression Web 2 and Dreamweaver) have the “.htm” extension.

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.