Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make html support include function like shtml in iis7.5

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to make html support include function as well as shtml in iis7.5". In daily operation, I believe many people have doubts about how to make html support include function like shtml in iis7.5. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the question of "how to make html support include function like shtml in iis7.5". Next, please follow the editor to study!

Prerequisites:

Installation of serversideincludemodule:

When installing iis, you can select the service ("include files on the server", option), as follows:

1: handle the mapper

Add module mapping request path * .html module select serversideincludemodule, fill in the name: ssinc-html

2: restart iis

Enter iisreset / restart in cmd

The detailed steps are as follows

1. First find the website that you want to modify is not a folder, and then find the handler mapping on the right and double-click to enter.

2. Find the following three

These three are stm,shtm,shtml three are all the same effect, but the suffix is different, we can open it and have a look.

3. We use * .shtm to open it, which makes it clear that it is achieved through module mapping, and it is convenient for us to add it later. Other .do can be executed the same as php, just refer to the original mapping method.

4. Let's add a copy as usual

Let * .html support shtm here, and you can see adding module mapping on the right.

5. The parameters are as follows

* .html

Select serversideincludemodule through the drop-down

6. You can write a name that you can easily identify.

7. By the same token, we can set * .htm in the same way.

Let me share with you the usage of shtm.

Shtml is a file for ssi technology. That is, the server side include--ssi server contains instructions. If some web server has ssi function. There will be a special treat for shtml files. Scan the shtml file first to see that there are no special ssi instructions. Interpret the ssi instruction according to the web server setting rules. After the explanation, transfer to the client together with the general html.

1. Config command

The config command is mainly used to modify the default settings of ssi. Where:

Errmsg: sets the default error message. In order to return the error message set by the user normally, the errmsg parameter must be placed in front of other ssi commands in the html file, otherwise the client can only display the default error message, not the custom information set by the user.

Timefmt: defines the format for the use of dates and times. The timefmt parameter must be used before the echo command.

The display results are as follows:

Wednesday, april 12, 2019

Perhaps the user is familiar with the% a% b% d used in the above example, so let's summarize some of the more common date and time formats in ssi in tabular form.

Sizefmt: determines whether the file size is expressed in bytes, kilobytes, or megabytes. If it is in bytes, the parameter value is "bytes"; for kilobytes and megabytes, you can use abbreviations. Similarly, the sizefmt parameter must precede the fsize command before it can be used.

2. Include command

The include command inserts text or pictures from other documents into the currently parsed document, which is the key to the entire ssi. Through the include command, you only need to change one file to update the entire site instantly!

The include command has two different parameters:

Virtual: gives a virtual path to a document on the server side. For example:

File: give a relative path to the current directory, where you cannot use ".. /" or an absolute path. For example:

This requires that each directory contain a header.html file.

3. Echo command

The echo command displays the following environment variables:

Document_name: displays the name of the current document.

The display results are as follows:

Index.html

Document_uri: displays the virtual path of the current document. For example:

The display results are as follows:

/ yourdirectory/yourfilename.html

As the site continues to grow, those longer and longer url addresses are sure to be a headache. If you use ssi, everything will work out. Because we can combine the domain name of the website with the ssi command to display the complete url, that is:

Http://yourdomain

Query_string_unescaped: displays unescaped query strings sent by the client, where all special characters are preceded by the escape character "\". For example:

Date_local: displays the date and time that the server sets the time zone. Users can customize the output information with the timefmt parameter of the config command. For example:

The display results are as follows:

Saturday, the 15 of april, in the year 2019

Date_gmt: the function is the same as date_local except that it returns a date based on Greenwich mean time. For example:

Last_modified: displays the last update time of the current document. Again, this is a very useful feature in ssi, as long as you add the following simple line of text to the html document, you can dynamically display the update time on the page.

Cgi environment variable

In addition to the ssi environment variable, the echo command can also display the following cgi environment variables:

Server_software: displays the name and version of the server software. For example:

Server_name: displays the host name, dns alias, or ip address of the server. For example:

Server_protocol: displays the name and version of the protocol used by the client request, such as http/1.0. For example:

Server_port: displays the response port of the server. For example:

Request_method: displays the client's document request methods, including get, head, and post. For example:

Remote_host: displays the name of the client host that sent the request information.

Remote_addr: displays the ip address of the client that sent the request information.

Auth_type: displays the authentication method for the user's identity.

Remote_user: displays the account name used by the user accessing the protected page.

4. Fsize: displays the size of the specified file. You can customize the output format with the sizefmt parameter of the config command.

5. Flastmod: displays the last modification date of the specified file, and the output format can be controlled combined with the timefmt parameter of the config command.

Here, we can use the flastmod parameter to display the update date of all linked pages on a page. The methods are as follows:

File

Another file

The display results are as follows:

File april 19, 2019

Another file january 08, 2019

6 、 exec

The exec command can execute a cgi script or a shell command. The method of use is as follows:

Cmd: executes the specified string using / bin/sh. If ssi uses the includesnoexec option, the command is blocked.

Cgi: can be used to execute cgi scripts. For example, the following example uses the counter.pl script in the server's cgi-bin directory to place a counter on each page:

At this point, the study on "how to make html support include functions like shtml in iis7.5" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report