我正在尝试重写一个网址,例如:
new_membership?R=1&I=2
为:
agent_new_membership.aspx?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>
我做错了什么?
提前致谢。
答案 0 :(得分:0)
这应该适合你:
<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>