To htm or not htm - that is the confusion

  JBX22 14:23 19 Jun 2007
Locked

Hi All,

Can anyone explain to me how this works?

Often I see sites that have pages simply in the convention "click here"

But when I publish my pages (Frontpage) I MUST specify the .htm on the end. That is :
"click here"

If I look for my pages without the htm my browser can't find them and in Frontpage if I delete the .htm extention it is far from happy.

Is there an easy way to make pages findable without the htm??

Thanks
JBX22

  Forum Editor 17:42 19 Jun 2007

must have either a .htm or a .html file extension. It doesn't really matter which extension you choose - the .htm extension is really a leftover from the days when software would only allow files to be saved with a three-letter file extension.

The first tag in any HTML document is <html>. This tells a browser that it is the start of an HTML document. The last tag in the HTML document is </html> and tells your browser that it has reached the end of the HTML document.

  robgf 17:43 19 Jun 2007

As far as I know, web pages always have to have a file extension, so that the browser knows how to open them, be it .htm, .php, .xml, or whatever.

Are you sure you are not confusing a folder:
....w.website.com/page/
Note the final /
The browser will then look in the folder for the page index.htm

  JBX22 19:12 19 Jun 2007

Thanks guys. That may well explain it. I think it is the folder/ that I'm confusing.

On the basis that I could end up with loads of index.htm files, I might just err on the side of caution - trouble is when I'm giving the link to people, there is a temptation not to bother typing in the .htm, so they get a file not found error.

Anyway, at least now I know why and I have a possible solution - even if it does confue me!!

Thanks
JBX22

  Forum Editor 00:38 20 Jun 2007

You must only have one index.htm file, or your site won't work.

  benjiboots 10:21 20 Jun 2007

In the root directory of the site, yes, but if your site is relatively small (i.e not many pages) you could put each page in its own folder and then name them index.htm.
That way you could give links out that reference the folder that the page resides in - eg:sitefolder/anotherfolder/
So all your pages can be named index.htm so long as they each reside in their own folder. The only problem with this is, if each page uses the same images (logos etc) which is in a folder called "images" in the root directory - any page in its own folder, wanting to reference those images will need to adjust its path accordingly (ie - ../imagename). It's six of one and half a dozen of another! And a lot harder to explain than to put into practice!!

  jtt 12:37 20 Jun 2007

What hapens if you have an index.htm and an index.html file? Which one wins?

  tf07 20:46 21 Jun 2007

It depends on the server, however to remove the extension, you use apaches mod_rewrite to convert /pagea to /pagea.htm it is often used to chane things like
click here
the current URL that a lot of search engines won't touch to something like click here
A lot easier to read for people and search engines

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

WPA2 hack: How secure is your Wi-Fi?

Add Depth Of Field to a photo using Tilt Shift Blur in Photoshop

iPhone tips & tricks

Comment afficher des fichiers cachés sur Mac ?