Deny access from specific word in referrer in htaccess

401 Views Asked by At

this is my first post, and I'm not so good in English (I speak baguette), sorry and thanks in advance.
Background: My website has huge access considered as spam, from Indonesia. I tried to check what was their common points (ip adress, browsers etc), and I found that their referrer is from a google result page on porn keyword (mainly "xnxx"). So I want to deny access with "xnxx" mention on it referrer. Posts I found about denying a whole site, but it would be nonsense to deny the whole google for me.
Solution I tried: I receive this code to put on my htaccess, but it didn't work.

#deny indonesia spam by its refering sites
RewriteEngine on
RewriteCond %{HTTP_REFERER} \bxnxx\b [NC]
RewriteRule .* - [F]

Do you have any idea about how I could fix it?

0

There are 0 best solutions below