我有一条这样的路径:
/folder?cat=1&name=Test
我需要一个IIS规则,将所有内容重定向到:
/folder/Test/1
我使用了它,但是不起作用:
<rule name="Rule" stopProcessing="true">
<match url="^folder$" ignoreCase="true" />
<conditions trackAllCaptures="true">
<add input="{QUERY_STRING}" pattern="cat=(.*)" />
<add input="{QUERY_STRING}" pattern="name=(.*)" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/folder/{C:1}/{C:2}" />
</rule>
答案 0 :(得分:0)
该规则如何:
<rule name="redirect" stopProcessing="true">
<match url="(.*)" />
<conditions trackAllCaptures="true">
<add input="{URL}" pattern="^/folder$" />
<add input="{QUERY_STRING}" pattern="cat=(.*)\&name=(.*)" />
</conditions>
<action type="Redirect" url="folder/{C:2}/{C:1}" appendQueryString="false" redirectType="Temporary" />
</rule>
它在我这边工作