Enjoy an ad free experience by logging in. Not a member yet?
Register .
08-18-2012, 09:10 PM
PM User |
#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.
08-18-2012, 10:53 PM
PM User |
#2
Senior Coder
Join Date: Sep 2010
Posts: 1,155
Thanks: 10
Thanked 148 Times in 148 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.
08-18-2012, 11:09 PM
PM User |
#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 ^^!
08-19-2012, 04:20 AM
PM User |
#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
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 04:23 AM ..
08-19-2012, 06:36 AM
PM User |
#5
Regular Coder
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
08-19-2012, 06:49 AM
PM User |
#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
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!
08-19-2012, 06:51 AM
PM User |
#7
Senior Coder
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 1,323
Thanks: 26
Thanked 100 Times in 100 Posts
Quote:
Originally Posted by
ameerulislam
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
08-19-2012, 06:54 AM
PM User |
#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
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?
08-19-2012, 06:58 AM
PM User |
#9
Senior Coder
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 1,323
Thanks: 26
Thanked 100 Times in 100 Posts
Quote:
Originally Posted by
ameerulislam
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
08-19-2012, 06:58 AM
PM User |
#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
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.
08-19-2012, 07:00 AM
PM User |
#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
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.
08-19-2012, 07:02 AM
PM User |
#12
Senior Coder
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 1,323
Thanks: 26
Thanked 100 Times in 100 Posts
Quote:
Originally Posted by
ameerulislam
what's ECoode, I looked up and can't find any definition of it.
Post #3.
Quote:
Originally Posted by
ameerulislam
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
08-19-2012, 07:06 AM
PM User |
#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
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
08-19-2012, 01:45 PM
PM User |
#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
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:
08-24-2012, 10:14 AM
PM User |
#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:
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 05:10 PM .
Advertisement
Log in to turn off these ads.