使用变量($ 1 $ 2)在IIS中重定向

问题描述:

现在我有一个重定向设置像这样

Right now I have a redirect set up like this

<rule name="EN" stopProcessing="true">
    <match url="en/(.*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
    <action type="Redirect" url="$1$2" />
</rule>

但是,不能正常工作。我试图让它如此时www.mysite.com/en/anything.aspx,用户在键入其重定向到www.mysite.com/anything.aspx~~V

However, it is not working properly. I'm trying to get it to be so when a user types in www.mysite.com/en/anything.aspx That it redirects to www.mysite.com/anything.aspx

我有我设置的东西错了,也许是不正确的语法的感觉。

I have a feeling I've set something up wrong, maybe incorrect syntax.

任何帮助将大大AP preciated !!

Any help would be greatly appreciated!!

请问您的病情得到了比赛,所以你知道的那部分就OK?
我不认为你用$ 1 $ 2,但{R:1} {R:2}等

Does your condition get a match so you know that part is OK? I dont think you use $1 $2 but {R:1} {R:2} etc.

<action type="Redirect" url="{R:1}" />

我没有测试过这一点,但我会尝试这样的:

I have not tested this, but I would try this:

<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>