1

http://www.example.comからのすべてのトラフィックをhttp://www.mysite.com/badreferer.aspx?bad=trueにリダイレクトしたいと考えています。

このために、IIS7のhttp://www.mysite.comの web.config ファイルにルールを作成しようとしました。

<rule name="bad referer" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
                    <add input="{HTTP_REFERER}" pattern="(.*)example(.*)" />
      </conditions>
      <action type="Redirect" url="/badreferer.aspx?bad=true" appendQueryString="false" />          
    </rule>

しかし、リダイレクトループに問題があります。

助けてください。

ありがとう。

4

1 に答える 1

1

これを試して:

<rules>
  <rule name="bad referer" stopProcessing="true">
    <match url="^(.*)" />
    <conditions>
      <add input="{HTTP_REFERER}" pattern="http://www.example.com(.*)" negate="true" />
    </conditions>
    <action type="Redirect" url="http://www.website.com/badreferer.aspx?bad=true" />
  </rule>
</rules>

アップデート:

<rule name="bad referer" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
        <add input="{REQUEST_URI}" pattern="/badreferer\.aspx?bad=true" negate="true" />
        <add input="{HTTP_REFERER}" pattern="^www.\example\.com.*" />
    </conditions>
    <action type="Redirect" url="/badreferer.aspx?bad=true" appendQueryString="false" />
</rule>
于 2013-05-29T16:42:36.253 に答える