Asp.net 使用变量在IIS中重定向($1$2)
我有一个这样的重定向设置Asp.net 使用变量在IIS中重定向($1$2),asp.net,redirect,iis,url-rewriting,iis-7,Asp.net,Redirect,Iis,Url Rewriting,Iis 7,我有一个这样的重定向设置 <rule name="EN" stopProcessing="true"> <match url="en/(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Redir
<rule name="EN" stopProcessing="true">
<match url="en/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="$1$2" />
</rule>
. 它重定向到
我有一种感觉,我设置了一些错误的东西,可能是不正确的语法。您的条件是否匹配,以便您知道该部分是正确的?
我认为你不用1美元2美元,但是{R:1}{R:2}等等
<action type="Redirect" url="{R:1}" />
我没有测试过这个,但我会尝试:
<rule name="EN" stopProcessing="true">
<match url="en/(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
</rule>
如果在(.*)后面有多个目录,则情况是否相同?所以恩/*/*?是的。与第一个(.*)匹配的所有内容都将是{R:1},下一个()将是{R:2}等等。