Welcome to WebmasterWorld Guest from

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)

10+ Year Member

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"

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)

10+ Year Member

I have a followup question about message #112 in this thread.
I have this rule in .htaccess:
RewriteCond %{HTTP_USER_AGENT} ^User_Agent_to_be_banned$ [NC]
RewriteRule .* includes/banned.html [L]
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:
RewriteCond %{HTTP_USER_AGENT} ^User_Agent_to_be_banned$ [NC]
RewriteRule .* includes/banned.html [L]



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

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


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.


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

Featured Threads

Hot Threads This Week

Hot Threads This Month