How to redirect visitors based on IP country?

Discussion in 'Programming' started by Ladan Lashkari, Feb 21, 2008.

  1. #1
    Do you know how to redirect your website visitors to different pages based on the country they are coming from?

    I know you can easily track the country from the IP address, but do you know of any easy script to install to do it for you?

    Because I need this for a very important project. I tried the famous IP2Location database but it was too complicated to install and you had to do everything step by step manually.

    Any suggestions?

    Thank you in advance! :)

    - Ladan
     
    Ladan Lashkari, Feb 21, 2008 IP
  2. pipsbank

    pipsbank Banned

    Messages:
    1,187
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i think you can do it in .htaccess, try google the tutorial from the internet
     
    pipsbank, Feb 21, 2008 IP
  3. tokyojoe66

    tokyojoe66 Guest

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Are you using php or asp? apache or IIS?
     
    tokyojoe66, Feb 21, 2008 IP
  4. sacada2

    sacada2 Well-Known Member

    Messages:
    320
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #4
    sacada2, Feb 21, 2008 IP
  5. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It is simple enough to do, depending on if your using PHP/ Apache or .Net/IIS etc

    Be aware that IP based redirection is only so good as there are several reasons why someones IP will appear to be in a different country to where they actually are - eg I used to work in the UK for an American company and so my work laptop would appear to have a USA IP
     
    AstarothSolutions, Feb 21, 2008 IP
  6. Ladan Lashkari

    Ladan Lashkari Active Member

    Messages:
    136
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #6
    I use PHP and Apache.
     
    Ladan Lashkari, Feb 21, 2008 IP
  7. Ladan Lashkari

    Ladan Lashkari Active Member

    Messages:
    136
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Thank you. I did. It has helpful info about redirection, but nothing about how to recognize which country the IP is from.

    That's the part actually I don't know how to do.
     
    Ladan Lashkari, Feb 21, 2008 IP
  8. Ladan Lashkari

    Ladan Lashkari Active Member

    Messages:
    136
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #8
    I hope it is simple as you said. I know the redirecting part is very easy, but is it also the IP country recognition part?
     
    Ladan Lashkari, Feb 21, 2008 IP
  9. Sergey Ten

    Sergey Ten Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Ladan,

    I think it is not so hard if you have any small PHP knowledge and ip2country database. ;)
     
    Sergey Ten, Feb 21, 2008 IP
  10. Sergey Ten

    Sergey Ten Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Ladan,

    Have a look at:
    *ttp://www.ip2location.com/articles/article2.htm

    I think it will help you :)
     
    Sergey Ten, Feb 21, 2008 IP
  11. tokyojoe66

    tokyojoe66 Guest

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #11
    this is what you need:

    ttp://www.ip2location.com/articles/article2.htm - (its not my site BTW)
     
    tokyojoe66, Feb 21, 2008 IP
  12. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #12
    It is the easy part, get the IP (one line of code) and query it against the db to get their country.
     
    AstarothSolutions, Feb 21, 2008 IP
  13. popnyc

    popnyc Active Member

    Messages:
    1,391
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #13
    I have found this site
    http://www.maxmind.com/app/custom_website

    Could anyone write a script for me to geotarget 2 countries? I don't have the skills to do this, I have an ad under the services category for this job, or please PM me.

    Thanks.
     
    popnyc, Jun 4, 2008 IP