Forum Moderators: phranque

Message Too Old, No Replies

htaccess - Ban by IP?

I have searched previous topics, but they do not help!

         

Jay77

12:21 pm on Jul 14, 2005 (gmt 0)



I am having a lot of trouble banning by IP with my .htaccess file. I have searched all previous threads on here for something relevant and all of Google trying to find a solution, but alas, it never seems to work!

Here's my current .htaccess, before banning:

######

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>

<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

AuthName <snip>
AuthUserFile <snip>
AuthGroupFile <snip>

######

My site is being terrorised by a particular IP address (that is static), and I would like to deny that IP all access to the site.

I have tried adding:

order deny,allow
deny from 123.456.789.012
allow from all

at the top, tried putting it in <limit get></limit> brackets, and in <files *></files> brackets. I have tried changing the order or allow & deny in all various combinations, but never having any success.

In all this testing I have been trying to ban my own IP (which of course I know), as that way I will know if it definitely works. And it definitely doesn't.

If anyone can see what I'm doing wrong or how it may be possible, please let me know!

Thank you very much...

jdMorgan

2:18 pm on Jul 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jay77,

Welcome to WebmasterWorld!

I'd suggest you carefully review the documentation for the Order directive in Apache mod_access [httpd.apache.org], since your order appears to be incorrect. Order has to do with access control precedence, and nothing to do with the order that Allow and Deny directives are listed below it.

Be sure to flush your browser cache (Temporary Internet Files) before testing any change to access control code. Otherwise, your browser will return requested pages from your local cache instead of sending the request to your server. Therefore, your access control code will not execute; It will have no effect on these requests, and will appear to be broken.

Jim