Add to /var/www/html/.htaccess
following lines:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Block/Forbid Referer Spammers/Referer Phishing
RewriteCond %{HTTP_REFERER} .*\.xyz [NC,OR]
RewriteCond %{HTTP_REFERER} .*\.best [NC]
RewriteRule .* - [F]
</IfModule>
Restart apache
sudo service apache2 restart