blocking semalt referrers with htaccess rules

前端 未结 5 1637
鱼传尺愫
鱼传尺愫 2021-01-03 11:22

I have implemented the following code to htaccess but are still seeing referrers from semalt, such as:

74.semalt.com
89.semalt.com

The code

5条回答
  •  攒了一身酷
    2021-01-03 12:23

    Your code looks good, syntax checks out ok! I 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 module mod_setenvif

    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 an Apache, Nginx & Varnish blacklist plus Google Analytics segment to prevent referrer spam traffic, you can find it here:

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

提交回复
热议问题