...

View Full Version : Different landing page for different geo location



ameerulislam
08-18-2012, 10:10 PM
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.

DrDOS
08-18-2012, 11:53 PM
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.

ECoode
08-19-2012, 12:09 AM
$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 ^^!

ameerulislam
08-19-2012, 05:20 AM
$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.

sonny
08-19-2012, 07:36 AM
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

ameerulislam
08-19-2012, 07:49 AM
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!

Len Whistler
08-19-2012, 07:51 AM
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:


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




----

ameerulislam
08-19-2012, 07:54 AM
Study if statements like the one ECoode provided and use this:


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?

Len Whistler
08-19-2012, 07:58 AM
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.





----

ameerulislam
08-19-2012, 07:58 AM
Study if statements like the one ECoode provided and use this:


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




----

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

ameerulislam
08-19-2012, 08:00 AM
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.

Len Whistler
08-19-2012, 08:02 AM
what's ECoode, I looked up and can't find any definition of it.


Post #3.


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.


---




----

ameerulislam
08-19-2012, 08:06 AM
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 :o

Will Bontrager
08-19-2012, 02:45 PM
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

chrislim2888
08-24-2012, 11:14 AM
Instead of keeping your own database, you can choose using the free web service http://www.ipinfodb.com

DrDOS
08-24-2012, 06:22 PM
After much thought about this post I make the following suggestion:

That you put a select box near the top of the page that lets the user choose their language from a list. It's the only sure fire way that will work regardless of browser or other parameters.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum