IIS httpd.ini rewrite 重写的时候如何忽略查询字符串?
2013-01-24 14:36
302 查看
原来自己一直以来都犯了一个错误!在指令上加O参数即可让IIS 重写忽略查询部分的字符串!
经过测试是正确的可以的!
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.
经过测试是正确的可以的!
RewriteRule directive
Syntax: RewriteRule Pattern FormatString [Flags] |
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.
相关文章推荐
- apche IIS .htaccess httpd.ini Rewrite RewriteRule详解
- 备份IIS httpd.ini 重写规则,兼容大部分版本IIS服务器
- 备份IIS httpd.ini 重写规则,兼容大部分版本号IISserver
- 伪静态重写模块rewrite.dll及httpd.ini文件参考下载
- 如何在IIS crash或者hang时候,dump 所有与IIS相关的memory?
- oracle 在本地查询远程数据库的方法,如何组合远程链接字符串
- IIRF(Ionic's Isapi Rewrite Filt er)入门,在IIS上重写Url[转 ]
- 如何设置IIS实现无扩展名重写
- httpd.ini重写教程
- mysql使用参数化查询,like模糊查询,应如何拼接字符串
- 6. 在数据库中条件查询很慢的时候,如何优化
- 如何用Python来进行查询和替换一个文本字符串?
- 如何在一个窗体关闭的时候,返回一个字符串
- IIRF(Ionic's Isapi Rewrite Filt er)入门,在IIS上重写Url
- sqlserver如何把查询的某个字段的列表转换为字符串输出
- 如何让byte数组转换为String字符串时候去除乱码的问号
- iis url重写模块 2 Rewrite
- struts2 如何在遍历元素的时候对每个元素进行截字符串
- 如何在html的div上动态显示带忽略信息的字符串。
- Spring JdbcTemplate 查询出的Map,是如何产生大小写忽略的Key的?