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

2024-12-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to make html and shtml support include function in iis7.5. The article is very detailed and has certain reference value. Interested friends must read it!

Prerequisites:

ServerSideIncludeModule installation:

When installing iis, select the service ("Include files on server side" option), as follows:

1: Process Mapper

Add module mapping request path *.html module select ServerSideIncludeModule, name fill in: SSINC-html

2: Restart IIS

Type iisreset /restart in cmd

detailed steps are as follows

1, first find the website to modify is not a folder, and then find the right side of the handler mapping double-click to enter

2. Find the following three

These three are stm,shtm,shtml three are the same effect, but the suffix is not the same, we can open to see.

3, we use *.shtm in order to open, this will understand, he is achieved through module mapping, our subsequent addition is convenient, other.do can be executed like php are the same as the original, refer to the original mapping method can be.

4, we add a copy as usual

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

5. Parameters are as follows

*.html

Select ServerSideIncludeModule by drop-down

6, the name can be written casually to identify their own

7, the same way we can let *.htm can also be set like this

Shtm usage to share with you

shtml is a file used for SSI technology. Server Side Include-SSI Server Side Include directive. Some Web servers have SSI capabilities. Shtml files will be given special treatment. First scan the shtml file to see that no special SSI instructions exist. Interpret SSI commands according to Web Server configuration rules. After explaining, transfer to client side together with general html.

1. Config command

The Config command is primarily used to modify SSI defaults. Of which:

Errmsg: Sets default error messages. In order to properly return user-defined error messages, the Errmsg parameter must be placed before other SSI commands in the HTML file, otherwise the client will display default error messages instead of user-defined error messages.

Timefmt: Defines the usage format for dates and times. The Timefmt parameter must precede the echo command.

The results are:

Wednesday, April 12, 2019

The %A %B %d used in the above example may be unfamiliar to users, but here is a tabular summary of some of the more common date and time formats used in SSI.

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

2. Include command

The Include command inserts text or images from other documents into the document being parsed, which is the key to SSI. With the Include command, you can update your entire site instantly by changing just one file!

The Include command has two different parameters:

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

File: Gives a relative path to the current directory, where "../" cannot be used "We cannot use absolute paths. 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 results are:

index.html

DOCUMENT_URI: Displays the virtual path of the current document. For example:

The results are:

/YourDirectory/YourFilename.html

As the site continues to grow, those longer and longer URL addresses are bound to cause headaches. If SSI is used, everything will be solved. Because we can combine the domain name of the website with the SSI command to display the full URL, namely:

http://YourDomain

QUERY_STRING_UNESCAPED: Displays the query string sent by the client without escape processing, where all special characters are preceded by the escape character "\." For example:

DATE_LOCAL: Displays the date and time of the server-set time zone. The user can customize the output information in conjunction with the timefmt parameter of the config command. For example:

The results are:

Saturday, the 15 of April, in the year 2019

DATE_GMT: Works the same as DATE_LOCAL, except 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 text to the HTML document, you can dynamically display the update time on the page.

CGI environment variables

In addition to SSI environment variables, the echo command can 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 from which the request message originated.

REMOTE_ADDR: Displays the IP address of the client from which the request originated.

AUTH_TYPE: Displays the authentication method for the user's identity.

REMOTE_USER: Displays the name of the account used by the user accessing the protected page.

4. Fsize: Displays the size of the specified file. The output format can be customized with the sizefmt parameter of the config command.

Flastmod: Displays the last modification date of the specified file, which can be combined with the timefmt parameter of the config command to control the output format.

Here, we can use the flastmod parameter to display the update dates of all linked pages on a page. The method is as follows:

File

Another File

The results are:

File April 19, 2019

Another File January 08, 2019

6 、 Exec

Exec commands can execute CGI scripts or shell commands. The method of use is as follows:

Cmd: Executes the specified string using/bin/sh. If SSI uses the IncludesNOEXEC option, the command is masked.

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

Above is "how to make html and shtml support include function in iis7.5" all the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

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

Servers

Wechat

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

12
Report