Many friends who have just started to make web pages find that there are so many extensions. In fact, htm and html are the same, and shtm and shtml are also the same. Note that for website optimization, it is recommended to use the same suffix. Basically, for visitors, html and htm can be two different contents. .htm VS .html First, let’s look at the difference between .htm and .html files. The answer is: they are the same. In fact, this is just a matter of personal preference, just keep the same suffix. Traditionally, Windows usually uses the suffix .htm, while Linux (Unix) uses the suffix .html (in Linux, if you open a .htm file, the source code will be displayed directly). This is because a long time ago, the operating system (DOS) platform was window 3.xx, and the system had an 8.3 naming convention for files, that is, the file name can only be 8 characters and the suffix can only be 3 characters, so it was obviously impossible to use the .html suffix at that time. Now, these problems no longer exist. (Personally, I feel that .html is more formal. Some people think that using .htm is a return to the DOS era.) Another problem is on the server side. If there are both index.html and index.htm files in a folder on the server, and the URL omits the file name (such as http://www.domain.dom/dirname/), then obviously one file will be read before the other (index.html will be parsed first). In fact, we usually don't save two index files in the same folder. .html VS .shtml Next, let's talk about the difference between .html and .shtml files. Simply put, a .shtml file is an html file with an ssi added. So, what the hell is SSI? In fact, I have come across this before, in the article Enable SSI configuration under Apache to make HTML support include. SSI is the acronym for Server Side Include. HTML text containing embedded server-side include commands. The SHTML document is completely read, parsed, and modified by the server before being sent to the browser. SSI is a command or pointer that can be called through a comment line in an HTML file. SSI has powerful functions. With just one simple SSI command, you can update the content of the entire website, dynamically display time and date, and execute complex functions such as shell and CGI scripts. A common problem encountered in website maintenance is that the structure of the website is fixed, but a large number of web pages have to be redone in order to update a little content. SSI provides a simple and effective way to solve this problem. It puts the basic structure of a website in a few simple HTML files (templates). All we have to do is upload the text to the server and let the program automatically generate web pages according to the template, making it easy to manage large websites. By applying it, some public areas of the website can be made into independent pages, and then this technology can be used to embed them into other pages that need the content of this area. mechanism: The SSI mechanism is a dynamic inclusion rather than a static generation. When a web server such as Apache receives a user's request and parses it to find an SSI inclusion instruction, it automatically takes out the included page and embeds it into the requested page and sends it to the user as a whole page. The user has no idea what the server has done, but only knows that he has received a complete page. From the working mechanism of SSI, we know that the inclusion action occurs every time a user requests a page, so if the content of the included page changes, it can be reflected in real time. Because of this, it is very easy to use it to realize dynamic embedding of static pages. We can use it to implement the public area of the entire website, or publish a lot of repeated area content into an independent static page, and then include it with SSI instructions where needed, such as the header and footer of the entire site, the latest news of the entire site, etc. In fact, SSI can also be enabled for .html files. You just need to make corresponding configurations in Apache. Once SSI is enabled, .html files and .shtml files can be treated the same. AddType text/html .shtml .html AddOutputFilter INCLUDES .shtml .html For specific configuration methods, please refer to Enable SSI configuration under Apache to enable HTML to support include As for the .shtm file, the source code was opened directly in the browser under window7 apache. |
<<: Simple CSS text animation effect
>>: Specific use of Docker anonymous mount and named mount
Table of contents Skeleton screen use Vue archite...
If you are not committed to becoming an artist, t...
Preface The server system environment is: CentOS ...
Preface This article aims to explain the most bor...
1. Which three formats? They are: gif, jpg, and pn...
First of all, I don't know why I can't lo...
In Linux, there are two types of file connections...
Effect (source code at the end): accomplish: 1. D...
MySQL group sorting to find the top N Table Struc...
This article records the installation tutorial of...
The innodb_autoinc_lock_mode parameter controls t...
Let’s learn together 1. Traditional methods Copy ...
1. Commonly used high-order functions of arrays S...
When we make a form, we often set a submit button ...
Use CSS styles and HTML tag elements In order to ...