
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.
|
Dragon Naturally Speaking I complete...
Newly Updated Bookmarking Sites 2012 ...
Great thanks, looks like i have alot ...
I totally agree that the taxonomy suc...
Hey There. DId you resolve your p...
yes you are right, this company is ho...
For years and years now I have been r...
Thanks for posting this great article...
I just bought this dvd 1 week ago and...
Excellent read, I just passed this on...
Really meaningful picture
whats wrong with taxonomy, yes Joomla...
I love drupal in-fact I have now desi...
great work, how much you charge per p...
I agree that "the profiles are of...