Forum Moderators: phranque

Message Too Old, No Replies

why ip blocking by .htaccess not working?

         

Jo555

1:37 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



There is a line below in the root directory .htaccess file.
deny from catv161.avis.ne.jp

However I'm still seeing the number of hits is growing for the hostname, from the web statistics. Why is the blocking not working?

jdMorgan

3:42 pm on Dec 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're not blocking by IP here, you're blocking by hostname.

In order for this to work, HostNameLookups must be enabled in your server configuration.

Many hosts DO NOT enable this option, because a host name lookup requires that your server send a Reverse-DNS request to the DNS system for every single page/image/script HTTP request that your server receives. This adds considerably to the load on your server and on the host's network. Because your server must wait for a response to its RDNS request before serving anything to your visitor, it slows down your server as well. If the RDNS lookup fails, then your server may 'hang' for a long time, and your visitor will think that your site has failed.

Therefore, you may wish to use IP-address-based access control:


Deny from 202.247.193.161

[added] No mod_access solution will keep the requests from being logged by your server and appearing as 'hits' in your stats. To stop connections entirely, you must use a firewall. However, mod_access will stop this client from getting the data that they want from your server, so perhaps they will go away eventually. This client will receive a 403-Forbidden response to any request. 'Stats' are fairly useless for this kind of work: See your raw server access logs to verify that a 403-Forbidden response is being sent.[/added]

Jim

[edited by: jdMorgan at 3:46 pm (utc) on Dec. 22, 2006]

Jo555

11:42 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



Thanks very much Jim.

I had a feeling that something is enabled yet for it to work, but I don't know much about server things. Now you gave me the perfect answer.

Merry Christmas and Happy New Year!