Geoip redirection using PHP versus apache .htaccess

Discussion in 'PHP' started by wormy, Jul 28, 2006.

  1. #1
    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.
     
    wormy, Jul 28, 2006 IP
  2. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    coderlinks, Jul 28, 2006 IP