Digital Point Forums
Send Money Online

Go Back   Digital Point Forums > Design & Development > Site & Server Administration > Traffic Analysis
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old Mar 24th 2005, 3:23 pm
kusadasi-guy kusadasi-guy is offline
Grunt
 
Join Date: Mar 2004
Posts: 83
kusadasi-guy is on a distinguished road
Stopping Referrer Spam

i am hitting by wan*er referrer spammers (like you all). How can i stop them?
They are using proxy servers, so that banning thier ip addresses is not a solid idea. ANd i dont want to reduce my servers performance with putting hundreds of lines to htaccess ( deny from spammer-casino/dot/com ...etc)

i scanned my logs and if i block some keywords then it would be prevent %80 of these spammers.

For example; if referrer link contains "casino" , "pharmacy" keywords, then stop it.

How can i do that with htaccess?

Last edited by kusadasi-guy; Mar 24th 2005 at 5:03 pm.
Reply With Quote
  #2  
Old Mar 24th 2005, 3:35 pm
digitalpoint's Avatar
digitalpoint digitalpoint is offline
My cat is on Prozac... really. lol
 
Join Date: Mar 2004
Location: San Diego, California
Posts: 22,364
digitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond reputedigitalpoint has a reputation beyond repute
Phone Verified
There isn't a "sure fire" way to do it unfortunately... but if you check some of the similar threads (look at the bottom of this page), there are some other threads about it.
__________________
- Shawn
Keyword Tracker now supports Google (once again) as well as Bing (new) and Yahoo
Please do not PM, IM or email me for product or tool support (they will go unread/ignored), and don't "friend" me unless we are really friends.
Reply With Quote
  #3  
Old Mar 24th 2005, 3:38 pm
Smyrl's Avatar
Smyrl Smyrl is offline
Moderator
 
Join Date: Mar 2004
Location: Scrub Oak Forrest
Posts: 9,491
Smyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond repute
Phone Verified
I do not have the answer, wish I did. I have seen two methods used that have some appeal to me. Both involve using .htaccess and doing something with sites based on
  • Words appearing in URL
  • URLs havng two or more dashes in them.

I have lost the URL showing first method. If someone has it I would appreciate your posting the link.

Thanks,
Shannon
Reply With Quote
  #4  
Old Mar 24th 2005, 3:51 pm
kusadasi-guy kusadasi-guy is offline
Grunt
 
Join Date: Mar 2004
Posts: 83
kusadasi-guy is on a distinguished road
I found it!



php Code:
RewriteEngine On

SetEnvIfNoCase Referer ".*(casino).*" BadReferrer
SetEnvIfNoCase Referer ".*(pharmacy).*" BadReferrer
SetEnvIfNoCase Referer ".*(gambling).*" BadReferrer
order deny,allow
deny from env=BadReferrer
IF a domain name (or its subdomain name) contains "casino", "pharmacy" and/or "gambling" then deny it.

I can prevent %70 of all my spammers with just few words.


Should i also put these lines to httpd.conf file to prevent all of the domains in the server?
Reply With Quote
  #5  
Old Mar 24th 2005, 7:19 pm
Smyrl's Avatar
Smyrl Smyrl is offline
Moderator
 
Join Date: Mar 2004
Location: Scrub Oak Forrest
Posts: 9,491
Smyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond repute
Phone Verified
Quote:
Originally Posted by kusadasi-guy
I found it!



php Code:
RewriteEngine On

SetEnvIfNoCase Referer ".*(casino).*" BadReferrer
SetEnvIfNoCase Referer ".*(pharmacy).*" BadReferrer
SetEnvIfNoCase Referer ".*(gambling).*" BadReferrer
order deny,allow
deny from env=BadReferrer
IF a domain name (or its subdomain name) contains "casino", "pharmacy" and/or "gambling" then deny it.

I can prevent %70 of all my spammers with just few words.


Should i also put these lines to httpd.conf file to prevent all of the domains in the server?
Here is other code I have found.

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^(http://www.)[a-z]+-[a-z]+- [NC]
RewriteRule ^(.*) http://%{REMOTE_ADDR}/ [R=301,L]

Can I use both to try to a double barrel shotgun approach?

Shannon
Reply With Quote
  #6  
Old Mar 25th 2005, 8:39 am
danpadams's Avatar
danpadams danpadams is offline
Champion of the Naaru
 
Join Date: Jan 2005
Posts: 101
danpadams is on a distinguished road
Smyrl, What does your code do exactally?
__________________
Dan
infoChi Christian Computing - Concordance
Reply With Quote
  #7  
Old Mar 25th 2005, 9:30 am
iShopHQ's Avatar
iShopHQ iShopHQ is offline
Twilight Vanquisher
 
Join Date: Apr 2004
Location: Florida
Posts: 621
iShopHQ will become famous soon enoughiShopHQ will become famous soon enough
If you're on a Windows box, you can set up a similar function in the global.asa file. Grab incoming referers, do an INSTR() check, and then a response.end that stops them in their tracks.
__________________
Bloggertizer Free blogger/advertiser matching site. Earn money blogging
LinkRotatr Save and then display random links on any site
|
Reply With Quote
  #8  
Old Mar 25th 2005, 9:39 am
J.D. J.D. is offline
of the Nightfall
 
Join Date: Nov 2004
Posts: 1,198
J.D. has a spectacular aura aboutJ.D. has a spectacular aura about
Quote:
Originally Posted by danpadams
Smyrl, What does your code do exactally?
It checks if the referrer string matches URLs like these:

http://www.abc-def-
abc-def-

And if it does, redirects the browser to the IP address of the browser itself.

J.D.
Reply With Quote
  #9  
Old Mar 25th 2005, 9:45 am
danpadams's Avatar
danpadams danpadams is offline
Champion of the Naaru
 
Join Date: Jan 2005
Posts: 101
danpadams is on a distinguished road
I hate to say it, but that is sorta being downright mean. In my opinion from the way I have my personal stuff setup, it wouldn't be as mean as possible as I have a webserver on my outside address, but that would mean the bandwidth would be used (the webserver is not in my own box but on the same IP #, why not just point to http://127.0.0.1?
__________________
Dan
infoChi Christian Computing - Concordance
Reply With Quote
  #10  
Old Mar 25th 2005, 9:51 am
Smyrl's Avatar
Smyrl Smyrl is offline
Moderator
 
Join Date: Mar 2004
Location: Scrub Oak Forrest
Posts: 9,491
Smyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond reputeSmyrl has a reputation beyond repute
Phone Verified
Quote:
Originally Posted by J.D.
It checks if the referrer string matches URLs like these:

http://www.abc-def-
abc-def-

And if it does, redirects the browser to the IP address of the browser itself.

J.D.
J.D., Can I use this

RewriteEngine On

SetEnvIfNoCase Referer ".*(casino).*" BadReferrer
SetEnvIfNoCase Referer ".*(pharmacy).*" BadReferrer
SetEnvIfNoCase Referer ".*(gambling).*" BadReferrer
order deny,allow
deny from env=BadReferrer


and

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^(http://www.)[a-z]+-[a-z]+- [NC]
RewriteRule ^(.*) http://%{REMOTE_ADDR}/ [R=301,L]

both in my .htaccess?

Shannon
Reply With Quote
  #11  
Old Mar 25th 2005, 10:04 am
J.D. J.D. is offline
of the Nightfall
 
Join Date: Nov 2004
Posts: 1,198
J.D. has a spectacular aura aboutJ.D. has a spectacular aura about
Quote:
Originally Posted by Smyrl
J.D., Can I use this
I never used SetEnvIf and can't say anything regarding its performance, but the fact that it assigns variables makes me think that it is probably not as fast as mod_rewrite.

I would rewrite the expressions as keyword instead of .*(keyword).* for performance reasons, but otherwise, either method or both should work fine.

J.D.

Last edited by J.D.; Mar 25th 2005 at 1:24 pm.
Reply With Quote
  #12  
Old Mar 25th 2005, 10:52 am
kusadasi-guy kusadasi-guy is offline
Grunt
 
Join Date: Mar 2004
Posts: 83
kusadasi-guy is on a distinguished road
Hello JD,

As i understand from your reply, these lines are better than SetEnvIf rules, right?


RewriteEngine On
RewriteCond %{HTTP_REFERER} (casino) [OR]
RewriteCond %{HTTP_REFERER} (pharmacy) [OR]
RewriteCond %{HTTP_REFERER} (gambling) [NC]
RewriteRule .* - [F]

Last edited by kusadasi-guy; Mar 25th 2005 at 1:26 pm.
Reply With Quote
  #13  
Old Mar 25th 2005, 1:11 pm
J.D. J.D. is offline
of the Nightfall
 
Join Date: Nov 2004
Posts: 1,198
J.D. has a spectacular aura aboutJ.D. has a spectacular aura about
These rules will return 403 (forbidden) when referrer contains any of the specified words:

RewriteCond %{HTTP_REFERER} poker [OR,NC]
RewriteCond %{HTTP_REFERER} casino [NC]
RewriteRule ^.? - [F]

Edit: I think rewrite rules will work faster, but I didn't actually run a test to verify this.

J.D.

Last edited by J.D.; Mar 25th 2005 at 1:24 pm.
Reply With Quote
  #14  
Old Mar 25th 2005, 1:38 pm
J.D. J.D. is offline
of the Nightfall
 
Join Date: Nov 2004
Posts: 1,198
J.D. has a spectacular aura aboutJ.D. has a spectacular aura about
Also, don't forget, the order in which rewrite rules are specified does matter. Rules denying access should go first (otherwise some of the perpetrators may slip through if they hit a preceeding rule with an [L] flag).

J.D.
Reply With Quote
  #15  
Old Mar 25th 2005, 1:45 pm
kusadasi-guy kusadasi-guy is offline
Grunt
 
Join Date: Mar 2004
Posts: 83
kusadasi-guy is on a distinguished road
Seems work perfectly J.D.
Thank You so much

Here is my new htaccess;
php Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} pharmacy [NC,OR]
RewriteCond %{HTTP_REFERER} viagra [NC,OR]
RewriteCond %{HTTP_REFERER} porn [NC,OR]
RewriteCond %{HTTP_REFERER} casino [NC,OR]
RewriteCond %{HTTP_REFERER} gambling [NC,OR]
RewriteCond %{HTTP_REFERER} phentermine [NC,OR]
RewriteCond %{HTTP_USER_AGENT}  ^LWP* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget [NC,OR]
RewriteCond %{HTTP_USER_AGENT}  ^lwp* [NC]
RewriteRule  .*      - [F]
BTW, whats the difference between "RewriteRule ^.? - [F]" and RewriteRule .* - [F] ?
Reply With Quote
  #16  
Old Mar 25th 2005, 1:51 pm
J.D. J.D. is offline
of the Nightfall
 
Join Date: Nov 2004
Posts: 1,198
J.D. has a spectacular aura aboutJ.D. has a spectacular aura about
Quote:
Originally Posted by kusadasi-guy
RewriteCond %{HTTP_USER_AGENT} ^LWP* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^lwp* [NC]
These are the same - [NC] stands for canse-insensitive string comparison.

Quote:
Originally Posted by kusadasi-guy
BTW, whats the difference between "RewriteRule ^.? - [F]" and RewriteRule .* - [F] ?
The first one will work faster because the regular expresion parser will have to match only one optional character at the beginning of the referrer string. The second one means "one or more" and the parser may need to process more characters.

J.D.
Reply With Quote
  #17  
Old Mar 25th 2005, 2:25 pm
kyle422's Avatar
kyle422 kyle422 is offline
Hand of A'dal
 
Join Date: Dec 2004
Posts: 290
kyle422 is on a distinguished road
Thanks for posting the solution kusudasi. I put it in my .htaccess and it works well for me.
Reply With Quote
  #18  
Old Mar 25th 2005, 2:36 pm
kusadasi-guy kusadasi-guy is offline
Grunt
 
Join Date: Mar 2004
Posts: 83
kusadasi-guy is on a distinguished road
Thanks to JD actually, i learned from him.

Just last thing, how can i do it for my server's websites? Should i add that lines (except "RewriteEngine on") to my httpd.conf file? or add to another file?
Reply With Quote
  #19  
Old Mar 25th 2005, 2:50 pm
J.D. J.D. is offline
of the Nightfall
 
Join Date: Nov 2004
Posts: 1,198
J.D. has a spectacular aura aboutJ.D. has a spectacular aura about
Quote:
Originally Posted by kusadasi-guy
Thanks to JD actually, i learned from him.

Just last thing, how can i do it for my server's websites? Should i add that lines (except "RewriteEngine on") to my httpd.conf file? or add to another file?
Rewrite rules can be placed in the server config, virtual domain sections or in the .htaccess file. Your choice.

J.D.
Reply With Quote
  #20  
Old Mar 25th 2005, 3:09 pm
TwisterMc's Avatar
TwisterMc TwisterMc is offline
Mac Guru
 
Join Date: Jun 2004
Location: Minneapolis
Posts: 972
TwisterMc is on a distinguished road
Any chance this is for a wordpress blog? I just implemented a plugin that helps block referrer spam.
__________________
: Thomas : Blog Marketing : SEO Designer :
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referrer spam summary J.D. Traffic Analysis 1 Jan 18th 2007 7:10 pm
Spam Report Coop Dominic General Chat 15 Aug 1st 2005 6:06 pm
Spam site in COOP niz85 Co-op Advertising Network 16 Mar 19th 2005 5:54 am
Stopping Referrer Spam Smyrl Traffic Analysis 18 Mar 16th 2005 6:58 am
Fight Email Spam With This Program "ABUSE" mddv All Other Tools 0 Jul 16th 2004 3:25 am


All times are GMT -8. The time now is 4:52 am.