What is the difference between the
.html file extension?
Why there are two of them?
Which is correct?
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, provided 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.
I think I should add this part here:
There is one single slight difference between .htm 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 go crazy and spit 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 load that file.
I tested this on my VPS and found this.
Maybe you could somehow set your server to load index.htm files by default, but I guess the .html file is the default file type for browsers to open in each directory.
Answered By – joe
Answer Checked By – Pedro (AngularFixing Volunteer)