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.
|
test comment
Pay attention to your colors Individu...
i m just interested in doing this jew...
Search for "angelae8654", cre...
lets not have any high hopes, there m...
I guess that is the stupidest post of...
Why not just make more money build we...
This is a great tip. Those annoying ...
that's a good tip ! Thx
Thank you! a great idea THAT'S A GOO...
I have been banned from craigslist. I...
lets not have any high hopes, there m...
Thank you! a great idea
Thank you so much! what a great idea!
i thought these way of promoting is n...