homepage Welcome to WebmasterWorld Guest from 54.234.2.88
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

This 122 message thread spans 5 pages: < < 122 ( 1 2 3 4 [5]     
A Close to perfect .htaccess ban list - Part 2
adriaant




msg:1508343
 11:46 pm on May 14, 2003 (gmt 0)

<modnote>
continued from [webmasterworld.com...]



UGH, bad typo in my original post. Here's the better version (I wasn't able to re-edit the older post?):

I'm trying to ban sites by domain name, since there are recently lots of reference spammers.

I have, for example, the rule:

RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*stuff.*\.com/.*$ [NC]
RewriteRule ^.*$ - [F,L]

which should ban any sites containing the word "stuff"
www.stuff.com
www.whatkindofstuff.com
www.some-other-stuff.com

and so on.

However, it is not working, so I am sure I did not setup a proper pattern match rule. Anyone care to advise?

[edited by: jatar_k at 5:06 am (utc) on May 20, 2003]

 

Wizcrafts




msg:1508463
 12:51 pm on Oct 13, 2003 (gmt 0)
I have a followup question about message #112 in this thread.
I have this rule in .htaccess:
[code]
RewriteCond %{HTTP_USER_AGENT} ^User_Agent_to_be_banned$ [NC]
RewriteRule .* includes/banned.html [L]
[/code]
Yesterday the selected UA visited my website again, using POST as his method. Instead of getting a 200 and seeing my special message page, the log shows that he got a generic 405 page, "method not allowed." Should I add a method rule to the rewrite condition for GET and POST? I figured that my rule would work for any allowed method (GET,POST,HEAD,OPTIONS), but I guess that is not really the case.

Is this what I need to add:
[code]
RewriteCond %{REQUEST_METHOD} ^(GET¦POST)$
RewriteCond %{HTTP_USER_AGENT} ^User_Agent_to_be_banned$ [NC]
RewriteRule .* includes/banned.html [L]
[/code]

Wiz

jdMorgan




msg:1508464
 3:27 pm on Oct 13, 2003 (gmt 0)

Wiz,

You (or your hosting service) may have another directive that is blocking POSTs, or maybe the server is set up to reject POSTs to html pages instead of cgi scripts.

Your thinking is correct - If you don't specify a method, mod_rewrite does not care about the method. It will treat all methods the same unless you tell it otherwise.

Look for a Limit or LimitExcept directive above the rewrite that is acting funny.

Jim



Continued in A close to perfect .htaccess ban list - Part 3 [webmasterworld.com]

[edited by: Marcia at 11:25 pm (utc) on Oct. 13, 2003]

This 122 message thread spans 5 pages: < < 122 ( 1 2 3 4 [5]
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