【发布时间】:2012-10-22 12:06:52
【问题描述】:
我在 URL 重写和尝试重写/重定向多个查询方面真的很新,但似乎不起作用。由于这是搜索结果并且带有不同的过滤,因此查询可能会有所不同。例如,在某些搜索中,我们可能有 t1=something 的查询,而在另一个搜索中,我们可能有 t2=somethingelse,有时我们可能会将它们组合起来,例如:t1=something&t2=somethingelse
我正在使用带有 web.config 的 IIS7,这是我迄今为止所做的:
这是我的示例链接
www.website.com/search/?t1=first&t2=second
我尝试了以下方法,但没有一个真正起作用:
(1)
<rewrite>
<rules>
<rule name="first" stopProcessing="true">
<match url="search/" />
<conditions trackAllCaptures="true">
<add input="{QUERY_STRING}" pattern="t1=([0-9a-zA-Z]+)" />
</conditions>
<action type="Redirect" url="search/{C:1}/" appendQueryString="false" />
</rule>
<rule name="second" stopProcessing="true">
<match url="search/" />
<conditions trackAllCaptures="true">
<add input="{QUERY_STRING}" pattern="t2=([0-9a-zA-Z]+)" />
</conditions>
<action type="Redirect" url="search/{C:1}/" appendQueryString="false" />
</rule>
</rules>
</rewrite>
(2)
<rule name="a" stopProcessing="true">
<match url="search2/" />
<conditions trackAllCaptures="true">
<add input="{QUERY_STRING}" pattern="t1=([0-9a-zA-Z]+)" />
<add input="{QUERY_STRING}" pattern="t2=([0-9a-zA-Z]+)" />
</conditions>
<action type="Redirect" url="search2/{C:1}/{C:2}" appendQueryString="false" />
</rule>
非常感谢任何帮助。
谢谢。
【问题讨论】:
-
很遗憾没有人回复
标签: iis-7 url-rewriting url-rewrite-module