ISAPI Rewrite unofficial Chinese configuration manual _ blue version 1/3 page

Source: Internet
Author: User
Tags configuration settings

This help file was issued because some of their ISAPI Rewrite settings were incorrect when setting up a host for a friend, and some even hindered the normal operation of the site. Let's make a rough translation of the official English help. You can freely use and repost data. However, if you want to repost it, please note that it is a blue translation version.

==============================
ISAPI Rewrite Configuration Overview:

On the NT/2000/XP and 2003 platforms, ISAPI Rewrite is injected into the INETINFO process and IIS under the system account to run the filter in coexistence mode. Therefore, the system account should give the ISAPI-rewirite dlls Internet Anonymous Access Group readable and executable permissions and all HTTPD. The INI file is readable and should also be given to the system account for all including HTTPD. The write permission of the folder of the INI file, which can generate HTTP. PARSE. ERRORS log file to record configuration file syntax ERRORS. Additional permissions are also required for the PROXY module because it will run in connection pool or HIGH-ISPLATED application mode, the IIS account sharing pool and HIGH-ISOLATION pool should be given to RWHELPERE. The read permission of the DLL. By default, IWAM-computer name is used for all pools. IN the corresponding COM + application settings, you should create a pool account by using COM + administration mmc snap-IN.

Format the configuration file:

Configuration files are divided into two types: GLOBAL (server GLOBAL mode) and INDIVIDUAL (site independent setup mode) files, GLOBAL (server GLOBAL mode) configuration files should be placed in the ISAPI-REWRITE installation directory, the name is httpd. ini. This file can be accessed and configured through the shortcut of the Start Menu. The ing rules in this file are global rules and will be effective for all sites. The INDIVIDUAL configuration file should be placed in the root directory of the Virtual Site and named httpd. INI file, which should be placed in the ing configuration settings for the site, only valid for the virtual site to be placed. Both types of httpd. ini are standard windows ini files. All the ing rules should be placed after [ISAPI_Rewrite. The previous file text will be ignored.

HTTPD. ini file example

[ISAPI_Rewrite]

# This is a comment

#300 = 5 minutes

CacheClockRate 300

RepeatLimit 20

# You are not authorized to download the httpd. ini and httpd. parse. errors files.

RewriteRule/httpd (? : \. Ini | \. parse \. errors)/[F, I, O]

# Block external access to the Helper ISAPI Extension

RewriteRule. * \. isrwhlp/[F, I, O]

# Configure rules

RewriteCond Host: (. +)

RewriteCond command

Syntax :( Syntax) RewriteCond TestVerb CondPattern [Flags]

This command defines a condition rule, and pre-runs the RewriteCond command before the RewriteRule, RewriteHeader, or RewriteProxy command. The following rule only has its, the pattern matches the current status of the URI and the additional conditions are also applied.

TestVerb

Specifies verb that will be matched against regular expression.

The expression defined in the verb matching rule.

TestVerb = (URL | METHOD | VERSION | HTTPHeaderName: | % ServerVariable) where:

URL-returns Request-URI of client request as described in RFC 2068 (HTTP 1.1 );

Returns the Request-URI of the requirement described by the client in RFC2068.

METHOD-returns HTTP method of client request (OPTIONS, GET, HEAD, POST, PUT, DELETE or TRACE );

Return the HTTP method required by the client (OPTIONS, GET, HEAD, POST, PUT, DELETE or TRACE)

VERSION-returns HTTP version;

Return HTTP Version

HTTPHeaderName-returns value of the specified HTTP header. HTTPHeaderName can be any valid HTTP header name. header names shoshould include the trailing colon ":". if specified header does not exists in a client's request TestVerb is treated as empty string.

Returns the value of the HTTP header file.

HTTPHeaderName =

Accept:

Accept-Charset:

Accept-Encoding:

Accept-Language:

Authorization:

Cookie:

From:

Host:

If-Modified-Since:

If-Match:

If-None-Match:

If-Range:

If-Unmodified-Since:

Max-Forwards:

Proxy-Authorization:

Range:

Referer:

User-Agent:

Any-Custom-Header

For more information about HTTP header files and their values, see RFC2068.

ServerVariable returns the value of the server variable defined by this parameter. For example, for the server port, the list of all server variables should be established in the IIS documentation, and the variable name should be prefixed with the % character;

CondPattern

The regular expression to match TestVerb

Rule expression matches TestVerb

[Flags]

Flags is a comma-separated list of the following flags:

O (nOrmalize)

Normalizes string before processing. Normalization nodes removing of an URL-encoding, illegal characters, etc. This flag is useful with URLs and URL-encoded headers

RewriteRule command

Syntax: RewriteRule Pattern FormatString [Flags]

This command can occur more than once. Each Command defines a separate rewrite rule. The definition commands of these rules are very important, because this command is useful when applying runtime rules.

I (ignore case)

This FLAG affects the RewriteRule command and the corresponding RewriteCond command regardless of case.

F (Forbidden)

Respond to the client, stop the REWRITING process, and send the 403 error. Note that in this case, FORMATSTRING is useless and can be set to any non-null string.

L (last rule)

Stop the rewrite process here without applying any rewrite rules. Use this FLAG to prevent the currently overwritten URI from being overwritten again by the subsequent rules.

N (Next iteration)

Force REWRITINGENGINE to adjust the rule target and restart the rule from scratch (all modifications will be saved). The number of reboots is limited by the value specified by RepeatLimit. If this value exceeds n flag, it will be ignored.

NS (Next iteration of the same rule)

Restart the rule process (for example, force repeated rule application) from the same rule with N, and use the RepeatLimit command to specify the maximum number of rules that are repeatedly implemented,

P (force proxy)

Force the target URI to be a proxy internally and immediately scale up to cope with proxy requirements through ISAPI. Make sure that the proxy string is a valid URI, including the Protocol host, or else the proxy will return an error.

R (explicit redirect)

Forces the server to send a redirection to the client to immediately respond and provide a new address of the destination URI. The redirection rule is often the final rule.

RP (permanent redirect)

It is almost the same as the [R] flag, but the 301HTTP status code is released instead of the 302HTTP status code.

U (Unmangle Log)

URI is recorded when the URI is a source requirement rather than a rewrite Requirement

O (nOrmalize)

Standardize the string before implementation. Standardization includes URL-ENCODING, invalid character re-movement, etc. This tag is useful for URLS and URLS-ENDODED Headers

CL (Case Lower)

Lowercase

CU (Case Upper)

Uppercase

RewriteHeader directive

Syntax: RewriteHeader HeaderName Pattern FormatString [Flags]

This command is a more general variant of RewriteRule. It not only overrides the client requirement of the URL, but also overwrites the HTTP header. This command is not only used for rewriting. Generate, delete any HTTP headers, and even change the client request Method

HeaderName

Specifies the customer header to be overwritten. The value is the same as the TestVerb parameter in the RewriteCond command.

Pattern

Restrict rule expressions to match Request-URI,

FormatString

Specify the FormatString of the new URI.

[Flags]

Is a command separation list of the following FLAGS

I (ignore case)

This FLAG affects the RewriteRule command and the corresponding RewriteCond command regardless of case.

F (Forbidden)

Respond to the client, stop the REWRITING process, and send the 403 error. Note that in this case, FORMATSTRING is useless and can be set to any non-null string.

L (last rule)

Stop the rewrite process here without applying any rewrite rules. Use this FLAG to prevent the currently overwritten URI from being overwritten again by the subsequent rules.

N (Next iteration)

Force REWRITINGENGINE to adjust the rule target and restart the rule from scratch (all modifications will be saved). The number of reboots is limited by the value specified by RepeatLimit. If this value exceeds n flag, it will be ignored.

NS (Next iteration of the same rule)

Restart the rule process (for example, force repeated rule application) from the same rule with N, and use the RepeatLimit command to specify the maximum number of rules that are repeatedly implemented,

R (explicit redirect)

Forces the server to send a redirection to the client to immediately respond and provide a new address of the destination URI. The redirection rule is often the final rule.

RP (permanent redirect)

It is almost the same as the [R] flag, but the 301HTTP status code is released instead of the 302HTTP status code.

U (Unmangle Log)

URI is recorded when the URI is a source requirement rather than a rewrite Requirement

O (nOrmalize)

Standardize the string before implementation. Standardization includes URL-ENCODING, invalid character re-movement, etc. This tag is useful for URLS and URLS-ENDODED Headers

CL (Case Lower)

Lowercase

CU (Case Upper)

Uppercase

To re-move the header, the format string mode should generate an empty STRING. For example, this rule will re-remove the proxy information from the customer request.

RewriteHeader User-Agent:. * $0

And the rule adds the OLD-URL HEADER to the request.

RewriteCond URL (. *) RewriteHeader Old-URL: ^ $1

The last example directs all WEBDAV requests to/WEBDAV by changing the request method. ASP

RewriteCond METHOD OPTIONS

RewriteRule (. *)/webdav. asp? $1

RewriteHeader METHOD OPTIONS GET

RewriteProxy directive

Syntax: RewriteProxy Pattern FormatString [Flags]

Force the target URI to be a proxy internally and immediately scale up to cope with proxy requirements through ISAPI. This will allow IIS to act as a proxy server and re-route to other sites and servers

Pattern

Restrict rule expressions to match Request-URI,

FormatString

Specify the FormatString of the new URI.

[Flags]

Is a command separation list of the following FLAGS

D (Delegate security)

Proxy mode will try to log on to the remote server with the current fake user qualification,

C (use Credentials)

Proxy mode will try to log on to the remote server with the qualification specified in the URL or basic Authorization header file, with this flag you can use http: // user: password@host.com/path/syntax as the URL

F (Follow redirects)

By default, ISAPI_Rewrite tries to redirect the redirection command returned by the remote MAP server to the local server namespace. If the remote server returns the redirection point to another location on the server, ISAPI_Rewrite will modify this important targeted command to point to the current server name, which will prevent users from seeing the real (internal) server name

Use the F flag to forcibly track the redirection commands returned by the remote server in the proxy mode. If you do not need to receive the redirection command from the remote server at all, there is a redirection restriction in WINHTTP settings to avoid remote redirection loops.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.