Forum Moderators: goodroi

Message Too Old, No Replies

A question about blocking IP from Nigerians

         

rjr686

10:41 pm on Jul 3, 2007 (gmt 0)

10+ Year Member



Is there a way to block IP Addresses from Nigeria using robots.txt?

jdMorgan

10:56 pm on Jul 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, because only robots --and more to the point, only good robots-- fetch and obey robots.txt.

On Apache, use mod_access or mod_rewrite to control access by IP address or address range. On IIS, you may be able to use ISAPI Rewrite. Or, if you use PHP headers, you could include code in your header to deny access to address ranges corresponding to certain countries.

However, there is more bad news, and that is that IP address ranges are allocated on request, and not allocated based on country. So you will either have to deny a fairly long list of IP address ranges, or deny them on an as-needed basis.

Another alternative is to use geoIP services to look up the country based on the IP address. These services build and maintain the huge databases needed to correlate IP addresses with countries, while giving you a simple method to query their database and receive the corresponding country code.

Try some searches here and abroad on the terms above; Each subject is fairly deep, with many options and sub-options, and beyond the scope of a reasonable-length forum post.

Jim