Welcome to WebmasterWorld Guest from 50.19.190.144

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

A Close to perfect .htaccess ban list - Part 2

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

New User

10+ Year Member

joined:May 14, 2003
posts:5
votes: 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]

12:51 pm on Oct 13, 2003 (gmt 0)

Full Member

10+ Year Member

joined:May 5, 2003
posts:316
votes: 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

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

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 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