如何在IIS上阻止Semalt

Flo*_*Flo 6 iis web-config spam-prevention spam

检查我的Google Analytics我从semalt.com获得了大量流量.我知道这是一种流量垃圾邮件策略,所以我想完全阻止他们的请求,并阻止它在我的流量统计中出现.

我在这里阅读http://logorrhoea.net/2014/01/how-to-block-semalt-com-referrer-traffic-using-htaccess/在Apache上可以这样做:

# block visitors referred from semalt.com
RewriteEngine on
RewriteCond %{HTTP_REFERER} semalt\.com [NC]
RewriteRule .* - [F]
Run Code Online (Sandbox Code Playgroud)

但我需要它为IIS,可能通过web.config,但如何做到这一点?

Flo*_*Flo 6

好的,在这里找到了一些东西:http://tusksoft.com/blog/posts/6/clean-up-your-google-analytics-and-help-stop-referer-spam-with-this-simple-rewrite-rule:

这似乎有效:

<rewrite>
  <rules>
    <rule name="abort referer spam requests" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_REFERER}" pattern="(semalt\.com)|(buttons\-for\-website\.com)" />
      </conditions>
      <action type="AbortRequest" />
    </rule>
    <!--The rest of your rules, if you have any-->
  </rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)