Many websites directs the user to specific subdomains or domains based on their location. For example, if a user based in the UK types yahoo.com, the user somehow redirected to uk.yahoo.com. If the user is based on another country, say Japan, the user is redirected to jp.yahoo.com (this is just an example).
My question is: How web servers identify the users' locations? Is this only base don the IP? Are there any other techniques?