Configuration:
On NT XP and 2003 platforms, the system account should inetinfo the program should be running with IIS5 in a coexistence mode filter. So the system account should be given to all the Isapi-rewirite DLLS and all the httpd. INI file with at least Read permission, we also recommend to give the system account for all including httpd. INI file's folder, which will allow HTTP to be generated. PARSE. Errors files that contain configuration file syntax errors. Additional permissions are required for the proxy module because it will run in connection pooling or high-isplated application mode, and the IIS account sharing pool and high-isolation pool should be given to Rwhelpere. The Read permission for the DLL. By default iwam-"computer name" is used in all pools, and a pool account should be established in the corresponding COM + application settings with the help of Com+administration MMC snap-in
configuration file Format:
There are two forms of configuration Files-global (server-level) and individual (site-leval) files, The global configuration file should be named Httpd.ini and appear in the Isapi-rewrite installation directory, and the file's shortcuts are provided through the Start menu, and the individual configuration file should be named httpd. INI and can appear in the physical root directory of the virtual site, the two types of formatting are the same and are standard Windows. INI file, all instructions should be placed in this section and all instructions should be placed with a divider line, any text other than this will be ignored
HTTPD. INI file example
Code:
[Isapi_rewrite]
# This is a comment
# 5 minutes
Cacheclockrate 300
Repeatlimit 20
# Block external access to 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]
# Some Custom Rules
Rewritecond Host: (. +)
Rewritecond directives
Syntax: (syntactic) Rewritecond testverb Condpattern [Flags]
This instruction defines a conditional rule that pretesting the rewritecond instruction before the rewriterule or Rewriteheader or rewriteproxy instruction, followed by its only pattern matching the current state of the URI and the additional conditions applied.
Testverb
Specifies verb that would be matched against regular expression.
Specifically defined verbs match the specified expression
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 requirements described by the client in RFC2068
Method-returns HTTP method of the client request (OPTIONS, GET, head, POST, put, DELETE or TRACE);
Returns HTTP methods for client requirements (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 is any valid HTTP header name. Header names should 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 a defined HTTP header file
Code:
Httpheadername =
Accept:
Accept-charset:
Accept-encoding:
Accept-language:
Authorization:
Cookies:
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
Get more information about HTTP header files and their values reference RFC2068
ServerVariable returns the value of a defined server variable. For example, the server port, the list of all server variables should be established in the IIS document, variable name to apply the% character reservation;
Condpattern
The regular expression to match Testverb
Regular expression Matching Testverb
Code:
[Flags]
The flags is a comma-separated list of the following flags:
O (normalize)
normalizes string before processing. Normalization includes removing of a url-encoding, illegal characters, etc. This flag are useful with URLs and url-encoded headers
Rewriterule directives
Syntax:rewriterule pattern formatstring [Flags]
This instruction can occur more than once, and each instruction defines a separate rewrite rule, which is important because the command is useful for applying runtime rules
I (Ignore case)
This flag affects rewriterule instructions and corresponding rewritecond directives, regardless of the case of a forced character match.
F (Forbidden)
React to the client, stop the rewriting process, and send a 403 error, noting that in this case the formatstring is useless and can be set to any non-empty string.
L (last Rule)
Do not apply any overriding rules this stops the rewrite process, using this flag to prevent the currently overridden URI from being rewritten again by the following rule
N (Next iteration)
Force Rewritingengine to adjust the rule target and reboot the rule check (all modifications will be saved), the number of restarts is limited by the value specified by Repeatlimit, if this number exceeds n flag will be ignored
NS (Next iteration of the same rule)
Working with n tags does not restart the rule rule process from the same rule (such as enforcing a duplicate rule application), specifying a maximum number of recurring rules through the repeatlimit instruction.
P (Force proxy)
Forcing the destination URI internally to enforce proxy requirements and to immediately address proxy requirements through an ISAPI extension, you must verify that the proxy string is a valid URI including the protocol host, or the proxy will return an error
R (Explicit redirect)
Forces the server to send a redirect to the client to indicate an immediate response, providing a new address for the destination URI, which is often the final rule
RP (Permanent redirect)
Almost identical to [R] tags but publishes a 301HTTP state instead of a 302HTTP status code
U (Unmangle Log)
Chronicle URI when URI is source requirement rather than overriding requirement
O (normalize)
Standardize the string before it is implemented. Standardization includes url-encoding, the movement of illegal characters, etc., which is useful for URLs and urls-endoded headers.
CL (case Lower)
Lowercase
CU (case Upper)
Capital
Rewriteheader directive
Code:
Syntax:rewriteheader headername pattern formatstring [Flags]
This directive is a more generalized variant of the Rewriterule, which not only overrides the client requirements section of the URL, but also overrides the HTTP header, which is not only used for rewriting. Generate, remove any HTTP headers, and even change the client request method
Headername
Specifies the client header to be overridden, with the desired value the same as the Testverb parameter in the Rewritecond directive
Pattern
Qualifying rule expressions to match Request-uri,
FormatString
Limit the formatstring that will generate the new URI
[Flags]
is a command-delimited list of the following flags
I (Ignore case)
This flag affects rewriterule instructions and corresponding rewritecond directives, regardless of the case of a forced character match.
F (Forbidden)
React to the client, stop the rewriting process, and send a 403 error, noting that in this case the formatstring is useless and can be set to any non-empty string.
L (last Rule)
Do not apply any overriding rules this stops the rewrite process, using this flag to prevent the currently overridden URI from being rewritten again by the following rule
N (Next iteration)
Force Rewritingengine to adjust the rule target and reboot the rule check (all modifications will be saved), the number of restarts is limited by the value specified by Repeatlimit, if this number exceeds n flag will be ignored
NS (Next iteration of the same rule)
Working with n tags does not restart the rule rule process from the same rule (such as enforcing a duplicate rule application), specifying a maximum number of recurring rules through the repeatlimit instruction.
R (Explicit redirect)
Forces the server to send a redirect to the client to indicate an immediate response, providing a new address for the destination URI, which is often the final rule
RP (Permanent redirect)
Almost identical to [R] tags but publishes a 301HTTP state instead of a 302HTTP status code
U (Unmangle Log)
Chronicle URI when URI is source requirement rather than overriding requirement
O (normalize)
Standardize the string before it is implemented. Standardization includes url-encoding, the movement of illegal characters, etc., which is useful for URLs and urls-endoded headers.
CL (case Lower)
Lowercase
CU (case Upper)
Capital
To move the header, FORMAT string mode should generate an empty string, for example, this rule will redirect agent information from the client request
Rewriteheader user-agent:. * $
And this rule will add the Old-url HEADER to the request.
Rewritecond URL (. *) Rewriteheader Old-url: ^$ $
The last example will redirect all WEBDAV requests to/webdav by changing the request method. Asp
Code:
Rewritecond Method OPTIONS
Rewriterule (. *)/webdav.asp?$1
Rewriteheader method OPTIONS Get
REWRITEPROXY directive
Syntax:rewriteproxy pattern formatstring [Flags]
Current 1/4 page
1234 Next read the full text