Everybody wants traffic but here is an option to block traffic from certain domain or IP.
For blocking visitors from referring domain add the following code in .htaccess file changing domain.com with domain you like to block:
RewriteEngineon
RewriteCond %{HTTP_REFERER} domain.com [NC] RewriteCond %{HTTP_REFERER} subdomain.domain.com [NC] RewriteCond %{HTTP_REFERER} baddomain. [NC] RewriteRule .* – [F]
For blocking traffic from certain IP add the following code in .htaccess file changing the IP address to IP you like to block:
allow from all
deny from 118.165.13.117