Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Different landing page for different geo location

    As far as I know there are 2 ways to do it. One is the .htaccess and one by using php.

    What I'm looking for is let say if my visitor is from US the it will go to the default

    mywebsite.com

    if from UK
    mywebsite.com/uk

    from Bangladesh
    mywebsite.com/bd

    and so on. If i don't have specific code for certain countries traffic from those countries will just go to he default page.

    Thanks in advance.

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    http://www.livio.net/main/charset.asp

    That site may provide some useful info, especially the HTTP_ACCEPT_LANGUAGE

    It can also be done with an IP list by country. There doesn't seem to be a 100% assured way, or an easy way.

  • #3
    New Coder
    Join Date
    Aug 2012
    Location
    Finland
    Posts
    23
    Thanks
    2
    Thanked 5 Times in 5 Posts
    PHP Code:
    $Language substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); 

    if( 
    $Language == "fi" ){ //fi for Finland (My language..)
        
    echo "You're from Finland!";
    }else{
        echo 
    "This is finnish site, you should use translator!";

    This might get you started ^^!

  • #4
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ECoode View Post
    PHP Code:
    $Language substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); 

    if( 
    $Language == "fi" ){ //fi for Finland (My language..)
        
    echo "You're from Finland!";
    }else{
        echo 
    "This is finnish site, you should use translator!";

    This might get you started ^^!
    I actually need it to redirect to the appropriate landing page.


    Let say if it is Finland it will go

    mysite.com/fn , even if I had typed mysite.com to enter my site.
    Last edited by ameerulislam; 08-19-2012 at 05:23 AM.

  • #5
    Regular Coder sonny's Avatar
    Join Date
    Apr 2008
    Location
    United States
    Posts
    567
    Thanks
    88
    Thanked 0 Times in 0 Posts
    You can do this with the GeoIP max mind database
    if you go that route, I will show you how easy
    that is to do. I would do that now, but I can't keep
    my eyes open.

    Sonny

  • #6
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sonny View Post
    You can do this with the GeoIP max mind database
    if you go that route, I will show you how easy
    that is to do. I would do that now, but I can't keep
    my eyes open.

    Sonny
    Ok bro, reply me when you wake up.

    Good night and Thanks!

  • #7
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by ameerulislam View Post
    I actually need it to redirect to the appropriate landing page.


    Let say if it is Finland it will go

    mysite.com/fn , even if I had typed mysite.com to enter my site.


    Study if statements like the one ECoode provided and use this:

    PHP Code:
    header('Location: http://www.mysite.com/fn'); 


    ----
    Leonard Whistler

  • #8
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    Study if statements like the one ECoode provided and use this:

    PHP Code:
    header('Location: http://www.mysite.com/fn'); 


    ----
    Hei Len, I figured out that part, but I don't know where to get the ip database or function to do the comparison.

    I'm retrieving ip $_SERVER['REMOTE_ADDR'];

    now I want to say if ip is in certain range go redirect to certain page.

    Is there anything built in php that has ip range database or something?

  • #9
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by ameerulislam View Post
    Is there anything built in php that has ip range database or something?
    No .... As far as I know you would have to buy the ip database and pay some sort of subscription to keep it up to date.





    ----
    Leonard Whistler

  • #10
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    Study if statements like the one ECoode provided and use this:

    PHP Code:
    header('Location: http://www.mysite.com/fn'); 


    ----
    what's ECoode, I looked up and can't find any definition of it.

  • #11
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    No .... As far as I know you would have to buy the ip database and pay some sort of subscription to keep it up to date.





    ----
    Is it so? There should be a free alternative or maybe a list that is big enough that I wouldn't need to worry about some minor updates.

  • #12
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by ameerulislam View Post
    what's ECoode, I looked up and can't find any definition of it.

    Post #3.

    Quote Originally Posted by ameerulislam View Post
    Is it so? There should be a free alternative or maybe a list that is big enough that I wouldn't need to worry about some minor updates.

    I figure there might be some limited free ip database. You would have to Google it and see if you can find one.


    ---




    ----
    Leonard Whistler

  • #13
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    Post #3.




    I figure there might be some limited free ip database. You would have to Google it and see if you can find one.


    ---




    ----
    oooh Poster Ecoode lol

  • #14
    Regular Coder
    Join Date
    Jun 2012
    Location
    Near Chicago, USA
    Posts
    123
    Thanks
    7
    Thanked 19 Times in 19 Posts
    Quote Originally Posted by ameerulislam View Post
    Is it so? There should be a free alternative or maybe a list that is big enough that I wouldn't need to worry about some minor updates.
    See the "Free / Open Source" column at
    http://www.maxmind.com/app/ip-location

    Will
    Numerology API for apps - Facebook, iPad, mobile phones. No charge to use API. [info]

  • Users who have thanked Will Bontrager for this post:

    ameerulislam (08-20-2012)

  • #15
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    Instead of keeping your own database, you can choose using the free web service http://www.ipinfodb.com

  • Users who have thanked chrislim2888 for this post:

    ameerulislam (08-25-2012)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •