Which extension should I choose for my HTML files and why?
问题:
回答1:
The short answer
There is none. They are exactly the same.
The long answer
Both .htm and .html are exactly the same and will work in the same way. The choice is down to personal preference, providing you’re consistent with your file naming you won’t have a problem with either.
Depending on the configuration of the web server, one of the file types will take precedence over the other. This should not be an issue since it’s unlikely that you’ll have both index.htm and index.html sitting in the same folder.
We always use the shorter .htm for our file names since file extensions are typically 3 characters long.
AND MORE ON: http://www.sightspecific.com/~mosh/WWW_FAQ/ext.html or http://www.sightspecific.com/~mosh/WWW_FAQ/ext.htm
i think i should add this part here:
i guess there is one single slight difference btw .html and .html files! consider a path in your server like: mydomain.com/myfolder if you create an index.htm file inside that folder and you open that like this:mydomain.com/myfolder/ it will goes crazy and split out your files as it is in your server,
but if you create an index.html file in there and open that directory in your browser, it will loads that file
i tested this on my vps and i endup with this answer
but maybe you could somehow set your server to loads index.htm files as default. but i guess the .html file is absolutely default file type for browsers to open in each directory!
回答2:
Neither!
If you're asking; "what would a website visitor rather type, htm or html" - it's much better to give them a nice descriptive URL with no extension. If they get used to going to yoursite/contact.html and you change it to yoursite/contact.php you've broken that link. If you use yoursite/contact/ then there's no problem when you switch technology.
回答3:
.html always for new files. .htm is a throwback to dos days.
回答4:
.html
- DOS has been dead for a long time. But it doesn't really make much difference in the end.
回答5:
Same thing.. makes no difference at all... htm was used in the days where only 3 letter extensions were common.
回答6:
If you plan on putting the files on a machine supporting only 8.3 naming convention, you should limit the extension to 3 characters.
Otherwise, better choose the more descriptive .html version.
回答7:
I guess it's a little too late now however the only time it does make a difference is when you set up HTML signatures on MS Outlook (even 2010). It's just not able to handle .html extensions, only .htm
回答8:
It's the same in terms of functionality and support. (most OS recognize both, most Search Engines recognize both)
For my everyday use, I choose .htm because it's shorter to type by 25%.
回答9:
Since nowadays, computers support widely any length as file type, the choice is now only personal. Back in the early days of Windows where only 3 letters where supported, you had to use .htm, but not anymore.
回答10:
Here is some food for thought.
If you had been using all .htm files on your website and now, for example, you have changed the editor that you are using, and your new editor is outputting all your files with the .html extension. When you re-publish your site to the server, it would seem to me that you could really hurt your SEO position/ranking as many of the links out there in the web, including Google, that were looking for the .htm and not the new .html for that same page. This assumes that you are still using the same page names from your old editor which would make sense.
Anyway... My point is, be careful not to loose that link juice you have build up. So I guess in this example, there is a reason to stick with .htm... But other then that as mentioned by everyone else they seem to be the same.
Please correct if I'm wrong.
The reason I mention all this is because this is what I was in the process of doing when it occurred to me I may be damaging the site SEO with the new editor.
The original editor was MS Front Page, which always outputted .htm, dead now, and the new editor "90 Second Web Builder 9" which outputs all .html files... Luckily, they must have thought about this and they included a way to change the output extension back to .htm
Anyway, that's my 2 cents... hope it helps someone..
回答11:
In short, they are exactly the same. If you notice the end of the URL, sometimes you'll see .htm and other times you'll see .html. It still refers to the Hyper-Text Markup Language.
回答12:
I have a site that is all .htm and was told by a computer "know it all" to change to .html because it would help google rank.. saved time and $