How to cut visitors from a certain url?

Apparently I'm very bad at formulating a question, because Google does not give anything like an answer. However, the topic has been raised many times — I'm sure of it.

The website is filled with a lot of traffic with buytraf is a aggregator. Find out who is pouring and devouring resources fails. I have a VPS with apachu. How can I do so that traffic Ref buytraf* cut off dead?
October 3rd 19 at 04:16
2 answers
October 3rd 19 at 04:18

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} otherdomain\.com [NC,OR]
RewriteCond %{HTTP_REFERER} anotherdomain\.com
RewriteRule .* — [F]
Oh, thank you!

Now everything was quiet and peaceful! - Devin32 commented on October 3rd 19 at 04:21
Then you can mark the answer as solution. - sincere_Hoppe commented on October 3rd 19 at 04:24
October 3rd 19 at 04:20
nginx is available? He can do that.
something like

if ($http_referer ~* (buytraf))
{ return 403; }
No need to practice with the variable $http_referer, there is a module - Devin32 commented on October 3rd 19 at 04:23

Find more questions by tags ApacheSpam