您的位置:首页 > 理论基础 > 计算机网络

IIS httpd.ini rewrite 重写的时候如何忽略查询字符串?

2013-01-24 14:36 302 查看
原来自己一直以来都犯了一个错误!在指令上加O参数即可让IIS 重写忽略查询部分的字符串!

经过测试是正确的可以的!

RewriteRule directive

Syntax: RewriteRule Pattern FormatString [Flags]
The RewriteRule directive is the real rewriting workhorse. The directive can occur more than once. Each directive defines one single rewriting rule. The
definition order of these rules is important, because this order is used when applying the rules at run-time.

Pattern
Specifies regular expression that will be matched against Request-URI. See
regular expression syntax section for more information.

FormatString
Specifies format string that will generate new URI. See
format string syntax section for more information.

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

I (ignore case)
Indicates that characters are matched regardless of a case. This flag affects
RewriteRule directive and all corresponding RewriteCond directives.

F (Forbidden)
Stops the rewriting process and sends 404 Not Found response (Not 403 Forbidden!. And this behaviour corresponds to the IIS 6 behaviour) to a client. Note that FormatString is useless in this case and could be set to any non-empty string.

L (last rule)
Stop the rewriting process here and don't apply any more rewriting rules. Use this flag to prevent the currently rewritten URI from being rewritten further by following rules.

N (Next iteration)
Forces rewriting engine to modify rule's target and restart rules checking from the beginning (all modifications are saved). Number of restarts is limited by the value specified in the RepeatLimit directive. If this number is exceeded N flag will be simply
ignored.

NS (Next iteration of the same rule)
Works like the N flag but restarts rules processing from the same rule (i.e. forces repeat of the rule application). Maximum number of single rule iterations is given by the RepeatLimit directive. But a number of single rule repeats does not count for the
global number of repeats (i.e. repeats limit for a number of iterations caused by N flag is independent of a number of repeats caused by NS).

P (force proxy)
Forces the result URI to be internally forced as a proxy request and immediately (i.e., rewriting rule processing stops here) put through the ISAPI extension that handles proxy requests. You have to make sure that the substitution string is a valid URI including
protocol, host etc. or proxy will return an error.

R (explicit redirect)
Force server to send immediate response to client with redirect instruction, providing result URI as a new location. Redirect rule is always the last rule.

RP (permanent redirect)
Almost the same as the [R] flag but issues 301 (moved permanently) HTTP status code instead of 302 (moved temporary).

U (Unmangle Log)
Log the URL as it was originally requested and not as the URL was rewritten.

O (nOrmalize)
Normalizes string before processing. Normalization includes removing of an URL-encoding, illegal characters, etc.
Also, IIS normalization of an URI completely removes query string. So, normalization should not be used if query string is needed. This flag is useful with URLs and URL-encoded headers.

CL (Case Lower)
Changes case of a format result to lower.

CU (Case Upper)
Changes case of a format result to upper.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  httd.ini IIS 重写