Iis 7 使用IIS URL重写模块使用查询字符串重写URL
我正在尝试重写url,例如:Iis 7 使用IIS URL重写模块使用查询字符串重写URL,iis-7,url-rewriting,query-string,Iis 7,Url Rewriting,Query String,我正在尝试重写url,例如: new_membership?R=1&I=2 致: 但是我得到了一个错误:“HTTP错误404.0-找不到” 这是我正在使用的web.config代码: <rewrite> <rewriteMaps> <rewriteMap name="Redirects"> <add key="/administration" value="/administration_main.aspx" /
new_membership?R=1&I=2
致:
但是我得到了一个错误:“HTTP错误404.0-找不到”
这是我正在使用的web.config代码:
<rewrite>
<rewriteMaps>
<rewriteMap name="Redirects">
<add key="/administration" value="/administration_main.aspx" />
<add key="/change_admin_password" value="/admin_change_password.aspx" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="New Membership" stopProcessing="true">
<match url="^new_membership?R=(\d+)&I=(\d+)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="agent_new_membership.aspx?R={R:1}&I={R:2}" />
</rule>
<rule name="Redirect rule1 for Redirects">
<match url=".*" />
<conditions>
<add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
我做错了什么
提前感谢。这应该适合您:
<rule name="TestRule" stopProcessing="true">
<match url="^new_membership\?R=(\d+)&I=(\d+)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="agent_new_membership.aspx?R={R:1}&I={R:2}" />
</rule>
仍然收到相同的错误。我已根据您的建议更新了原始帖子,以包含完整的重写代码,以防与其他内容冲突。更新了模式,但仍然没有成功:(
<rule name="TestRule" stopProcessing="true">
<match url="^new_membership\?R=(\d+)&I=(\d+)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="agent_new_membership.aspx?R={R:1}&I={R:2}" />
</rule>