在IIS7 URL重写模块中,我可以在重定向规则中指定不适用于http-post请求吗? [英] In the IIS7 URL Rewrite module, can I specify in a redirect rule to not apply to http-post requests?
问题描述
在IIS7 URL Rewrite模块中,我可以在重定向规则中指定不适用于http-post请求吗?我使用Microsoft提供的模板来小写所有URL并附加一个尾部斜杠。但是我有一个AJAX帖子请求不符合这个规范,但他们打破我们他们被重写为301s。我并不担心SEO的POST请求所以我更愿意,如果我可以在规则中指定忽略它。以下是我的规则:
In IIS7 URL Rewrite module, can I specify in a redirect rule to not apply to http-post requests? I am using the templates provided by Microsoft to lowercase all urls and to append a trailing slash. However I have a AJAX post requests that don't meet this specification but they break we they are rewritten as 301s. I am not worried about POST requests for SEO so I would prefer if I could just specify in the rule to ignore it. Below are my rules:
<rule name="AddTrailingSlashRule" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}/" />
</rule>
<rule name="LowerCaseRule" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
推荐答案
您可以访问<$ c $中的内容c> {REQUEST_METHOD} 条件下的变量。
You have access to that in the {REQUEST_METHOD}
variable under the conditions.
<add input="{REQUEST_METHOD}" matchType="Pattern" pattern="POST" ignoreCase="true" negate="true" />
这篇关于在IIS7 URL重写模块中,我可以在重定向规则中指定不适用于http-post请求吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!