I have some sites which are heavily used(maybe abused is more accurate) by IP blocks in India, China, Saudi, Iran and Brazil. Its a free web proxy so thats why. Since it was dragging my system down I just went into my firewall packet filter and banned those IPs. Now I am thinking of a more sophisticated approach where I just use either apache or PHP to redirect them to another subdomain or domain. I own the .net as well as the .com tlds so I was thinking of somehow redirecting chosen IP blocks(maybe countries) to .net where I do throttling or some other procedure to control the abuse. Or I could just go to the .net during peak hours and have it say its shut down due to load problems. But anyway...is there any other snippets of code out there already written in PHP that I could just adapt and put on my index page? I want to be able to permanently redirect certain IP blocks from .com/index.php to .net/index.php right from the beginning. Is apache a better tool for this or php? I am thinking in terms of overhead now...and CPU cycles. Is it expensive to have .htaccess rules that are constantly checking an external IP against a database of IPs to see if they should be redirected or is it not that pricey in terms of CPU power? I heard of the mindmax geip stuff but I could make do with something far more simple that has a list of IP blocks that it will compare against and redirect.
There is a free Ip-country database at : http://ip-to-country.webhosting.info/ It has IPs encoded in decimal format. So you just have to see if it is within the given ranges in CSV file to check the country. How the ip format is calculated can be seen here: http://ip-to-country.webhosting.info/node/view/55 An example of using it can be seen here: http://ip-to-country.webhosting.info/node/view/118 Thomas