user1048676
user1048676

Reputation: 10066

Block specific URL from hitting your site

All, I'm getting a lot of traffic to my website from back links and it's affecting my google analytics. Is there a way to block a specific website from accessing my website through .htaccess? For example purposes, if I want to block http://foo.com how would I do that? Is there a better way then .htaccess?

Thanks in advance!

Upvotes: 0

Views: 1731

Answers (1)

Ulrich Palha
Ulrich Palha

Reputation: 9539

Try adding the following to your .htaccess file

#if the request came from foo.com
RewriteCond %{HTTP_REFERER} ^http://foo\.com$
#then serve it a 403 Forbidden
RewriteRule . - [F,L]

Upvotes: 3

Related Questions