Url rewriting iis7.5,web.config如何将不存在的文件(页面)重定向到其他页面?
我正在使用Url rewriting iis7.5,web.config如何将不存在的文件(页面)重定向到其他页面?,url-rewriting,iis-7.5,url-redirection,web.config-transform,Url Rewriting,Iis 7.5,Url Redirection,Web.config Transform,我正在使用iis-7.5和web.config文件 我想将“somepage.asp?id=63”重定向到“somepage/10.html” 我的web.config如下所示: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules>
iis-7.5
和web.config文件
我想将“somepage.asp?id=63”
重定向到“somepage/10.html”
我的web.config如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="301 Redirect 2" stopProcessing="true">
<match url="somepage.asp?id=63" />
<action type="Redirect" url="somepage/10.html" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
它不起作用,当我将
更改为
(delete?id=63)时,它起作用了,为什么?怎么办?据我所知,url重写匹配url模式与查询字符串不匹配
如果您想根据查询字符串重定向url,我建议您可以尝试使用条件
更多详细信息,您可以参考以下url重写规则:
<rule name="Redirect according to query string" stopProcessing="true">
<match url="somepage.asp" />
<conditions>
<add input="{QUERY_STRING}" pattern="id=63" />
</conditions>
<action type="Redirect" url="somepage/10.html" appendQueryString="false" />
</rule>