Blocking links to semantics with htaccess rules

I used the following code for htaccess, but I can still see links from semalt, for example:

74.semalt.com
89.semalt.com

      

Code:

# Block visits from semalt.com
RewriteEngine on 
RewriteCond %{HTTP_REFERER} ^http://([^.]+\.)*semalt\.com [NC]
RewriteRule .* - [F]

      

Any idea how these referrers bypass this rule (which I found on the internet) and how can I prevent them entirely?

+3


source to share


5 answers


Ok, this is how I got it working:



# Block visits from semalt.com
RewriteEngine on 
RewriteCond %{HTTP_REFERER} ^http://([^.]+\.)*semalt\.com [NC]
RewriteRule (.*) http://www.semalt.com [R=301,L]

      

+1


source


Your code looks good, syntax is checked fine! I've used these mod_rewrite methods:

RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?semalt\.com.*$ [NC]
RewriteCond %{HTTP_REFERER} ^http(s)?://(.*\.)?semalt\.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*semalt\.com\ [NC,OR]

      

or with the .htaccess mod_setenvif module



SetEnvIfNoCase Referer semalt.com spambot=yes
SetEnvIfNoCase REMOTE_ADDR "217\.23\.11\.15" spambot=yes
SetEnvIfNoCase REMOTE_ADDR "217\.23\.7\.144" spambot=yes

Order allow,deny
Allow from all
Deny from env=spambot

      

I even created a blacklist "Apache", "Nginx" and "Varnish", as well as a Google Analytics segment to prevent spam traffic in the referrer, you can find it here:

https://github.com/Stevie-Ray/referrer-spam-blocker/

+4


source


Here is the updated code for many spam referral sites using regular expressions

<IfModule mod_rewrite.c>
    RewriteEngine On
    Options +FollowSymLinks
    RewriteCond %{HTTP_REFERER} (?:o-o-6-o-o|bestwebsitesawards|s.click.aliexpress|simple-share-buttons|see-your-website-here|forum.topic55198628.darodar|hulfingtonpost|ilovevitaly|priceg|blackhatworth|semalt.semalt|kambasoft|buttons-for-website|BlackHatWorth|7makemoneyonline)\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} (?:lomb|lombia|econom|lumb)\.co [NC,OR]
    RewriteCond %{HTTP_REFERER} (?:cenoval|Iskalko)\.ru [NC,OR]
    RewriteCond %{HTTP_REFERER} (?:smailik|humanorightswatch)\.org [NC,OR]
    RewriteCond %{HTTP_REFERER} (?:ranksonic|savetubevideo)\.info [NC]
    RewriteRule ^ – [F]
</IfModule>

      

Hope someone finds this helpful

+2


source


I've tried all these pieces of code from all over the internet. None of them worked, and Semat kept changing his domains and paths.
I suggest this, which works great for me and has a sane syntax. It will apply to any referrer path that contains the string semalt.com. Note that you need Apache 2.4 for this. It can go in your .htaccess without issue, or theoretically in your main Apache config.

<If "%{HTTP_REFERER} =~ /semalt.com/">
        Deny from all
</If>

      

Good luck!
Update: if this throws a 500 error you need to extend your .htaccess in your main Apache config, in this example I have my .htaccess in my web root / var / www / wordpress so I have in mine. conf:

<Directory /var/www/wordpress>
    Options +FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

      

0


source


Here's another approach for blocking the ever growing list of botnet hosts:

# Block Common Botnets
SetEnvIfNoCase Referer fbdownloader.com spambot=yes
SetEnvIfNoCase Referer descargar-musicas-gratis.com spambot=yes
SetEnvIfNoCase Referer baixar-musicas-gratis.com spambot=yes
SetEnvIfNoCase Referer savetubevideo.com spambot=yes
SetEnvIfNoCase Referer srecorder.com spambot=yes
SetEnvIfNoCase Referer kambasoft.com spambot=yes
SetEnvIfNoCase Referer semalt.com spambot=yes
SetEnvIfNoCase Referer ilovevitaly.com spambot=yes
SetEnvIfNoCase Referer 7makemoneyonline.com spambot=yes
SetEnvIfNoCase Referer buttons-for-website.com spambot=yes
SetEnvIfNoCase Referer econom.co spambot=yes
SetEnvIfNoCase Referer acunetix-referrer.com spambot=yes
SetEnvIfNoCase Referer yougetsignal.com spambot=yes
SetEnvIfNoCase Referer darodar.com spambot=yes

Order allow,deny
Allow from all
Deny from env=spambot

      

0


source







All Articles