.htm vs .html [closed]

2019-01-30 07:23发布

Which extension should I choose for my HTML files and why?

12条回答
Melony?
2楼-- · 2019-01-30 07:47

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

查看更多
淡お忘
3楼-- · 2019-01-30 07:52

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,enter image description here
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!

查看更多
ゆ 、 Hurt°
4楼-- · 2019-01-30 07:53

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 $

查看更多
做自己的国王
5楼-- · 2019-01-30 08:00

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.

查看更多
成全新的幸福
6楼-- · 2019-01-30 08:01

.html always for new files. .htm is a throwback to dos days.

查看更多
欢心
7楼-- · 2019-01-30 08:02

.html - DOS has been dead for a long time. But it doesn't really make much difference in the end.

查看更多
登录 后发表回答