我希望将所有页面从特定文件夹及其子文件夹重定向到根文件夹上的页面。我在IIS 7.5中编写了以下规则,但它无法正常工作。请指教。
<rule name="someName" stopProcessing="true">
<match url="/MoveFromThisFolder/.*" />
<action type="Rewrite" url="/ToThisFile.html" appendQueryString="false" />
</rule>
答案 0 :(得分:1)
我修改了规则如下,它对我有用!
&lt; rule name =“SomeRule”stopProcessing =“true”&gt;
&lt; match url =“^ FromThisFolder /(.*)”/&gt;
&lt; action type =“Redirect”url =“ToThisFile.html”appendQueryString =“false”/&gt;
&LT; /规则&GT;
答案 1 :(得分:-1)
尝试摆脱领先的“/”
<rule name="someName" stopProcessing="true">
<match url="^MoveFromThisFolder/($|[\?/].*)" />
<action type="Rewrite" url="ToThisFile.html" appendQueryString="false" />
</rule>