How to block referrer traffic using .htaccess

The short version

Block from your site by adding these lines to your .htaccess file

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

The long version

This is going to a massively geeky post compared to my usual rubbish but I hope at least a few people will find it useful.

A few days ago, I was checking the site stats on and noticed that a domain – – kept popping up with a url that contained ‘competitors_review.php’. I took a look at the link (I’m deliberately not posting that up the link since I think that’s what these traffic spammers want) and there’s very little information: just a sign-up form. I did a bit of digging around and judging by what I’ve seen on other blogs and on Twitter, the general consensus is that are best avoided and there’s a whole load of suspicion about why they’re trying to harvest information about people by getting them to sign up to whatever service it is they’re offering with their Facebook accounts. It’s kind of clever – playing on people’s curiosity and making it look like a ‘competitor’ site is gleaning information from your site – but it stinks. If anyone from wants to put the counter argument, I’m all ears.

Update 21 Jan 2014: found a couple of other blogs with a bit more info about See WTF is and What is the website about?

Anyway, onto the practical bit. I’ve now blocked from appearing in my site stats by adding these lines of code at the end of my .htaccess file. Disclaimers: the .htaccess directives below are based on information in Media Temple’s knowledge base article: How to block a specific IP address from accessing your website. This works for my particular WordPress blog and its .htaccess file. I put them at the very end of my own particular .htaccess file. YMMV, and I provide no warranty as to what this might do to your own site. If you don’t know what your .htaccess file is or how to change it, I’d suggest you find some other way to block

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

191 comments on “How to block referrer traffic using .htaccess”

  1. DerrickE says:

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} ^http://.*semalt\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*kambasoft\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*savetubevideo\.com [NC]
    RewriteRule (.*) [R=301,L]

    This is what Alvi and Gina were trying to do, with some improvements.
    This blocks the semalt urls (including subdomains)
    and redirects their bots back to them. If you simply want to deny access, change 301 with 403

    Just place this at the very top of your .htaccess file.
    If you want to block/redirect any other domains, just add them in the following format:
    RewriteCond %{HTTP_REFERER} ^http://.*domain\.com [NC,OR]

  2. […] I haven’t tried this one yet and I typically don’t get deep into code (over my head mostly) for my clients but you can give the advanced method to block a try too.  It has to do with adding a snipit of code to your .htaccess file and I have attached some links for that too; Block Semalt or Block Referrer Traffic. […]

  3. Greg Kristan says:

    I just added this line of code to my HT Access file. I am really excited to see if this stops the amount of useless traffic and spam I keep getting to my site

    Thanks for the help!


  4. Brad says:


    I am dealing with the same crap with a bunch of my clients’s sites. I have just been blocking them by excluding the traffic in the admin section of my site. I just wrote a quick post on it on my site here

    Let me know if you think that way works just the same.


  5. ccm says:

    Thanks for the tip on blocking semalt and other analytics “spammers”. As a small-time webmaster, this info saved my bacon with an annoyed client.

  6. Al says:

    I was investigating this problem and the first hit on seamalt crawlers is this page:

    Doesn’t seem malicious and they offer an opt out.

    • marek says:

      You sound like someone working for semalt or have no idea what you talking about. First off, if it was a legit crawler it would have identified itself as such and obey robot txt file. Instead this cockroach of the internet is pretending to be a user screwing up webmaster’s stats and eating precious bandwidth. Moreover, this cockroach of the internet once blocked tries to sneak back using questionable methods. On top of it they send useless fake traffic. Let me tell you this, a legit crawler DOESN’T behave like this. A useless cockroach or scumbag like semalt DOES. Thanks to the contributors to this post I and I hope other webmasters were able to get rid of this cockroach wasting people’s time.

    • Greg says:

      Doesnt work, I opted out months ago and still get spammed by them. Theres a post on another blog where people have had the same problem with this rubbish continuing.

      Hope this htaccess mod works!!

  7. jack says:

    I installed this code on 11 different websites. Semalt is still getting through.

  8. […] their site’s htaccess /webconfig files if they have […]

  9. Jimmy Blunted says:

    You need to add extra code.
    try this

    # BLOCK Spammers
    RewriteCond %{HTTP_REFERER} (\.)?(semalt|kambasoft|savetubevideo|seoanalyses)\.com$ [NC]
    RewriteCond %{HTTP_REFERER} semalt\.semalt\.com [NC]
    RewriteRule . – [F]

  10. Dennis Foreman says:

    Updated DETER SEMALT code for htaccess files.

    SEMALT has added additional domains that originate their spam. Below is an updated code snippet which will cope with the following:,,,,,,,

    The code snippit should be placed at the very beginning of your htaccess file.

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} ^http://.*semalt\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*kambasoft\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*savetubevideo\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*yapoga\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*bottlenose\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*descargar-musica-gratis\.net [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*baixar-musicas-gratis\.com [NC]
    RewriteRule (.*) [R=301,L]

  11. Simon says:

    Thanks for the info. I was seeing about 10 referrals per day from semalt and before resorting to blocking the site via .htaccess, I tried the removal request form they have on their site. It seems to have worked so far. Haven’t seen a single referral since I made the request.

    • kwikspeak says:

      Hi Simon, thanks for your comment. It reminds me to share my result after submitting my sites to removal request. I make this promise few weeks ago when I’m looking for how to avoid semalt and jumped to

      Well, my result was same as Simon case. There’s none of those robots showing up on my Analytic until now. I think they respect webmaster request.

      So, for you who want to try. Go on and try it, submit your site to removal request. There is no data you need to submit except your Domain, that’s all.

      And if you guys don’t mind, I have a question. Do you guys have any experience with Spider Spanker wordpress plugin? Please share with me, I think I need a plugin with functionality like this.

      PS: I’m not affiliated with Semalt in any condition, just sharing my experience.

  12. Bears Fan says:

    Worked flawlessly. I was getting really tired of seeing this SEMALT crap in my Jetpack stats. Much appreciated!

  13. Follower says:

    Possible directives via .htaccess …

    # Blocks visitors referred from:
    # 1., *
    # 2., * (semalt)
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} (www\.)?semalt\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*semalt\.com/ [NC,OR]
    RewriteCond %{HTTP_REFERER} (www\.)?7makemoneyonline\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://.*7makemoneyonline\.com/ [NC]
    RewriteRule ^(.*)$ – [F]

    • marek says:

      Just a quick FYI, there is a new spam underway from Russia that might show up in your Google Analytics as a fake referral as coDOTlumbDOTco, lombDOTco, ilovevitalyDOTcom, forum.topic####.darodarDOTcom,darodarDOTcom creating fake top page lumbDOTco.

      This is how you can get rid of it.
      Go to Google Analytics admin, select your account, under ‘View’ select ‘Filters’ create new filter ‘+New Filter’
      For each fake referral ( coDOTlumbDOTco, lombDOTco, ilovevitalyDOTcom, forum.topic####.darodarDOTcom,darodarDOTcom) I have 3 filters.
      1. Predefine —>> Exclude –>> traffic from ISP domain –>> that are equal to. In ‘ISP Domain’ box type the fake referral for example: lombDOTco, save it.
      2. Custom —>> Filter Field = referral –>> Filter Pattern –>> type lombDOTco, save it
      3. Custom —>> Filter Field = hostname –>> Filter Pattern –>> type lombDOTco, save it

      The filters are updated on the hour, if you set up yours let’s say at 9:40 all fake referrals will be gone form your GA few minutes past 10. I set up my filters 2 days ago and haven’t seen them since. It works.
      Trying to figure out how to block them in htaccess file is waste of time and it doesn’t work because they do not visit your website, therefore there is nothing to block. The spam is being pushed through GA not your website.

  14. Dennis Foreman says:

    Attached is updated SEMALT-blocking .htaccess code.

    Blocks referrals from the nine (9) domains I’ve encountered on my sites, and, has been revised to be more concise and efficient.

    Install this code at the head of your .htaccess file.

    Additionally, it is my experience that semalt ignores removal requests however formatted and however often they are submitted. I would suggest that you not rely upon them honoring yours.


    # SEMALT HTTP Referrer Blocking

    RewriteCond %{HTTP_REFERER} (?:baixar-musicas-gratis|descargar-musica-gratis|savetubevideo|7makemoneyonline|buttons-for-website|darodar|ilovevitaly|kambasoft|semalt)\.com [NC]
    RewriteRule ^ – [F]

    # END SEMALT Referrer Blocking

  15. David Minton says:

    Glad to see I am not the only webbie who went ballistic when they saw this crap in their stats. Kinda like the U2 shit on my iPhone, no real biggie, just a pain, something I didn’t ask for and don’t want……. and MAJOR distraction in my day.

    I am thinking to send an invoice to the scammers.

    My tab to the uninvited Ukrainians will include:

    The time I had to take to track their IP [ ( and (] Ran a tracert which gave me these yesterday and today, but it looks like they change from time to time, so I’m ready to block all traffic from 217.23 (their Dutch ISP).

    Time to research who the f**k they are.

    Time to handhold one of my clients, an elderly artist whose low volume website is an underpaid labor of love on my part (treat your legacy clients well, they got ya up and running!!).

    Her usual 20 or 30 hits of real visitors a day was indeed significantly skewed, and those visits are very important to HER!!! More to the point it took my patience and time to explain that she had not really had a sudden magic jump in visitors, nor was site in “danger”, and who this flaky robotic visitor was, and what their hidden agenda really was.. the time for this task is still TBD!!!!

    This is why webbies get grey!

  16. […] the code. I particularly liked the approach taken by Kenneth Yau at in his blog post, How To Block Referrer Traffic Using htaccess. He provides a very short description of what you need to do (just copy and paste), and follows […]

  17. Manuel GR says:

    Taking the example I have added some directions more. I hope someone find this usefull, because locking one to appear more.

    RewriteCond %{HTTP_REFERER} (?:o-o-6-o-o|bestwebsitesawards|see-your-website-here|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]

  18. Don Schnell says:

    May as well block SiteJabber too.
    Who needs their sad pathetic traffic? 80% of them are bashing good sites for a thrill.

    # Blocks visitors referred from:
    # 1., *
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} ^http://.*sitejabber\.com/ [NC,OR]
    RewriteRule ^(.*)$ – [F]

  19. Don Schnell says:

    Oops, my bad try this, works for me now.

    # Block all trafffic from SiteJabber
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} ^http://.*sitejabber.*$ [NC]
    RewriteRule ^.* – [F,L]

Leave a comment