Jay*_*Jay 9 iis-7 url-rewriting url-rewrite-module
我真的很新的URL重写和尝试重写/重定向多个查询,但似乎无法正常工作.由于这是搜索结果并且具有不同的过滤,因此查询可能会有所不同.例如,某些搜索我们可能有查询,t1=something而另一方面我们可能有t2=somethingelse,有时我们可能会将它们组合成:t1=something&t2=somethingelse
我使用IIS7与web.config,这是我到目前为止所做的:
这是我的示例链接
www.website.com/search/?t1=first&t2=second
Run Code Online (Sandbox Code Playgroud)
我试过以下,其中没有实际工作:
(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>
Run Code Online (Sandbox Code Playgroud)
(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>
Run Code Online (Sandbox Code Playgroud)
我真的很感激任何帮助.
谢谢.
| 归档时间: |
|
| 查看次数: |
2097 次 |
| 最近记录: |