How To Block Visitors From Specified Domain Or IP Addresses ?

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 with domain you like to block:

RewriteCond %{HTTP_REFERER} [NC]
RewriteCond %{HTTP_REFERER} [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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.