Jump to content
xisto Community
whistle

How To Forward Url According To The Ip?

Recommended Posts

Do you ever see that a website support multiple language, and the website will forward you to a homepage written by one of the language according to your ip address. That is, the website has multiple sets of pages. Each set of pages is writted by a specific language. When you link to the website, it can determine your ip and country you live accord to the ip. Thus the language where you live could be determined, and a preferred set of pages can be assign to response to you.It seems that this kind of webside must know which ip is correspondent to which country, corresponding to a specific language. Or some website prove a service for determining the country according to a IP, thus the forgoing website can get the response from the service for forwarding you to the preferred set of pages.Could anyone share useful information about this or useful tools to do it? PHP scripts is preferred. Thank you for reading my post.

Share this post


Link to post
Share on other sites

hers are some useful websites to help you out but you would have to search thgouh alot of scripts to find waht your looking ofr though.

http://forums.xisto.com/no_longer_exists/
http://www.dnsstuff.com/

Share this post


Link to post
Share on other sites

Checked by IP is not perfect. I prefer checking by explorer leanguage accept.

Somthing like this, from one of my pages: (they check is explorer accept PL leanguage, polish, my orygin)

<?php$lang = getenv('HTTP_ACCEPT_LANGUAGE');$lang = preg_replace('/(;q=[0-9]+.[0-9]+)/i','',$lang);$lang_array = explode(",", $lang);$i=0;$isPL = FALSE;$isEN = FALSE;while ($i != 10) {   $language = strtolower($lang_array[$i]);  $language = substr ($language, 0, 2);  if ( $language != '' )  {    if ( $language == 'pl' ) {$isPL = TRUE;} else {$isEN = TRUE;}  }  $i++;}if ($isPL == TRUE){  // POLISH CONTENT}else{  // EANGLISH CONTENT}?>

You can put more then one option ... i leave this for future.


--------------------

Practice is when evrything is work but no one know why.
Theory is when work nothing but evry one know why.
Programmers join Practice with Theory - nothing work and no one know why :)

Share this post


Link to post
Share on other sites

meh i was more like using them for referances on what they were looking for, cuz i had a hard time looking for scripts that fall in the lines of what whistle was looking for.

Share this post


Link to post
Share on other sites

*moved to the PHP forum since you mentioned PHP scripts*

 

165089[/snapback]


Actually, this thread was on other forum and moved to here by Buffalohelp. :D

 

Checked by IP is not perfect. I prefer checking by explorer leanguage accept.

 

165227[/snapback]


Thanks for your help. Your scripts are simple and easy to be understood. It is really another way to reach the same target. If I can't find the scripts related to the country IP, it must be the best way.

 

For the script, I have a question. If I query and get a response in Polish version because the language setting in my browser is Polish. Will my browser be changed to english version when I change the language setting to English?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.