How to block Semalt in IIS

Checking my Google Analytics. I get a lot of traffic from semalt.com. I know that this is a traffic traffic tactic, so I want to completely block their requests and stop it from being included in traffic statistics.

I read here http://logorrhoea.net/2014/01/how-to-block-semalt-com-referrer-traffic-using-htaccess/ that this can be done on Apache, for example:

# block visitors referred from semalt.com RewriteEngine on RewriteCond %{HTTP_REFERER} semalt\.com [NC] RewriteRule .* - [F] 

but I need it for IIS, perhaps via web.config, but how to do it?

+6
source share
3 answers

Ok, found something here: http://tusksoft.com/blog/posts/6/clean-up-your-google-analytics-and-help-stop-referer-spam-with-this-simple-rewrite- rule :

It works:

 <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> 
+6
source

Try this, it should work:

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

I tested and verified this, but for the referrer url except * .semalt.com. The key in this code, other than your code, is a wildcard at the end of the referrer template, because the referent URL ends with "/". You can also replace the wildcard at the end with "/", although I believe the pattern should be better.

+3
source

The following is an example web.config with the equivalent Rewrite URL configuration with the one you provided.

 <?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> 
+2
source

All Articles