homepage Welcome to WebmasterWorld Guest from 54.204.58.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Is this correct code for blocking referer spam?
proboscis




msg:4452332
 5:45 pm on May 11, 2012 (gmt 0)



If "example" is the domain name will this block referer spam from example dot anything plus subdomains?


SetEnvIf Referer example. bad_referer=1

deny from env=bad_referer

 

wilderness




msg:4452346
 6:31 pm on May 11, 2012 (gmt 0)

you don't have to use the complete domain name and/or extension.

1) your env setting is ok.
2) change this to (IF REFEr contains example):
SetEnvIf Referer example bad_referer

Note; you may use other words that come from the refers line as well, the use is not limited to domain name, just as long as you USE "contains", rather than the "begins with" or "ends with" anchors.

This belongs in the SSID forum [webmasterworld.com]

proboscis




msg:4452645
 6:17 pm on May 12, 2012 (gmt 0)

Okay, thanks wilderness. I don't need the dot there I guess?

lucy24




msg:4452718
 10:40 pm on May 12, 2012 (gmt 0)

In this specific context the dot won't do any harm, but it isn't needed... UNLESS there exist sites called, say, exampleofgoodstuff.com and you don't want to block those. Then it can make a big difference.

SetEnvIf and the shortcut BrowserMatch both use Regular Expressions. That means an unescaped dot . means "any character at all". If you need it to mean "only a dot and nothing else" then you have to escape it with a backslash like this \.

proboscis




msg:4452763
 2:28 am on May 13, 2012 (gmt 0)

Okay, I think I've got it. Thanks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved