2014-03-05 37 views
6

檢查我的Google Analytics(分析)我從semalt.com收到大量流量。 我知道這是一個流量垃圾郵件策略,所以我想完全阻止他們的請求,並阻止它在我的流量統計中出現。如何在IIS上阻止Semalt

我這裏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] 

,但我需要它的IIS,可能是通過在web.config,但是怎麼辦呢?

+0

最近,我也看到了 「semalt.semalt.com」 爲參照網址。 –

回答

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

感謝@Flo在我所有的網站最是煩人的social-buttons.com因此增加他們在system.webServer <規則名稱=「中止引薦垃圾郵件請求」 stopProcessing =「真」> <匹配的網址=「。*」/> <動作類型= 「AbortRequest」/> <! - 你的規則的休息,如果您有任何 - > Langeleppel

+0

要添加到我的答案中:並非所有引薦垃圾郵件都會設置引用來源主機名,因此這些仍會在您的Google Analytics日誌中彈出。 發現這個偉大的職位在這裏:http://www.analyticsedge.com/2014/12/removing-referral-spam-google-analytics 摘要:它做的是檢查訪問者是否設置了一個有效的主機名(如:您的網站主機名或已知的主機名)。如果沒有,您可以將其過濾掉。因此,不是排除所有垃圾郵件網站(並且必須維護該列表),而只包含有效的訪問。檢查受衆羣體>技術>網絡>主機名以查看網站請求的主機名。 – Flo

2

下面是一個示例web.config,其中具有與您提供的URL配置相同的URL重寫配置。

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="block semalt referer" patternSyntax="Wildcard" stopProcessing="true"> 
      <match url="*" /> 
      <conditions> 
      <add input="{HTTP_REFERER}" pattern="*.semalt.com" /> 
      </conditions> 
      <action type="AbortRequest" /> 
     </rule> 
     </rules> 
    </rewrite> 
    </system.webServer> 
</configuration> 
+0

我之前用完全相同的規則回答了我自己的帖子,但我仍然在Google Analytics流量統計中查找......所以出於某種原因,此規則不起作用。 – Flo

+2

我有'stopProcessing =「true」'的其他規則,所以請確保這是您的''中的第一個條目。 – Richard

3

試試這個,它應該工作:

 <rewrite> 
      <rules> 
       <rule name="RequestBlockingRule1" patternSyntax="Wildcard" stopProcessing="true"> 
        <match url="*" /> 
        <conditions> 
         <add input="{HTTP_REFERER}" matchType="Pattern" pattern="*.semalt.com*" 

ignoreCase="true" negate="false" /> 
        </conditions> 
        <action type="AbortRequest" /> 
       </rule> 
      </rules> 
     </rewrite> 

我已經測試和驗證這一點,但對於參照網址不是* .semalt.com等。此代碼中的關鍵字與您的代碼不同,它是引用來源模式末尾的通配符,因爲引用者網址以「/」結尾。儘管我認爲通配符應該更好,但也可以用「/」替換最後的通配符。