Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 使用变量在IIS中重定向($1$2)_Asp.net_Redirect_Iis_Url Rewriting_Iis 7 - Fatal编程技术网

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}等等。