Forum Moderators: phranque

Message Too Old, No Replies

ban IP address in .htaccess

         

axilos

3:04 pm on Jan 30, 2009 (gmt 0)

10+ Year Member



Hello,

one bot tries every 2 mins accessing my website from one fixed IP address. I want to ban that ip address in .htaccess file and I success but not completly.

My .htaccess file looks like this:
<Limit GET POST>
order allow,deny
deny from x.x.x.x
allow from all
</Limit>

First I tried without Limit rows but result is same.

Problem is that IP address is banned when bot tries to access site with GET method but when try with POST he succed. I saw in log file banned IP address with POST method.

Actualy, I didn't used POST method on site but want to ban this IP address completly...

jdMorgan

4:44 pm on Jan 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Order Allow,Deny
Deny from 12.34.56.789
Allow from all

Used without the <Limit> container, your code should work just fine. However, be aware that only one "Order" directive can exist outside of mutually-exclusive containers (such as <Limit> and <Files>) in .htaccess. If more than one "Order" directive applies to a request, only the last one in your file will be used.

Also, if the requested URL refers to a resource which is defined in your server configuration as an Alias, then mod_alias may divert the request to a directory where your .htaccess code does not apply. This is also true of requests where mod_proxy or any other URL-to-URL or URL-to-filepath translation module might apply.

If you are testing using your own IP address, be sure to completely flush your browser cache between tests (or disable it temporarily). Otherwise, you will see stale cached responses, and your test results will be invalid.

Jim

[edit] Ficksed speling and bbCode formatting errurs[/edit]

[edited by: jdMorgan at 3:33 pm (utc) on Feb. 2, 2009]

axilos

8:35 am on Feb 2, 2009 (gmt 0)

10+ Year Member



Ah, I didn't know that banned IP addresses are in log also :)

thx