Blocking Users Or Sites By The Referrer With .Htaccess Code |
|
| Htaccess |
| Saturday, 07 July 2007 08:05 |
|
When checking your logs on the server you suddenly see a many referrals from some site, but when you inspect that site closely you can not spot any incoming links from them. Those referrals are not legitimate, they do not come from incoming links, the site is obviously hot linking your files especially images, css files or other files. The logs on your server will generate any kind of reference to your site that could be traced of course. Blocking access by the referrer can be done with apache mod_rewrite to make a list of the referrers. Usually mod rewrite is installed on most of the servers, but you can ask your host-support about mod rewrite. So to block all traffic that comes from a particular domain, use this code in the .htaccess file:
How to block traffic from a single domain:
RewriteEngine on
# Options +FollowSymlinks RewriteCond %{HTTP_REFERER} custombadsite\.com [NC] RewriteRule .* - [F]
How to block traffic from multiple domains
RewriteEngine on
# Options +FollowSymlinks RewriteCond %{HTTP_REFERER} custombadsite\.com [NC,OR] RewriteCond %{HTTP_REFERER} anothercustombadsite\.com RewriteRule .* - [F]
"[NC]" at the end of the line means that the domain is case insensitive and even if the domain is typed with capitals, it will still be blocked.
|
We ordered 500 images retouching pack...
Guys from Seoandwebdesign.com did ast...
Your retouching was great, we will or...
We ordered 500 images retouching pack...
Drupal isn't the problem, it's the da...
Drupal definately rocks, yes if you l...
just build your own framework and cms...
I did not twitter this post, I was re...
Then why twitter this now? That was ...
Well that was 2 years ago, now Drupal...
1. "Their Forum is super slow, I ...
Many costumers really loved this dvd,...
why? Explain in more details please
Zane Durant from www.renoseo.com, www...
you can check our jewelry gallery for...