Forum Moderators: mack
At least make sure that users can override your choice.
It's not something that you can simply "script into the splash page" or "put into the htaccess file". You'll need to put the IP address data into some sort of database, and look IPs up in the database. You'll need some script to do that. You'll need to update the database frequently (it changes daily).
The country block for the U.S. comprises 500k of text. Canada is nearly 100k.
U.S. IP block [ipdeny.com]
The problem with using IP addresses for geolocation is that there is no guarantee that the listed addressees are actually in the countries they were issued to.
All it indicated is that the addresses were issued to the IP-granting authority in a given country. Once issued to a commercial enterprise or organization, there is nothing to stop them from using them anywhere in the world.
All it tells you is what country's IP-granting authority is ultimately in control of an address. What it tells you is political - not physical.
As an example, Google uses U.S. IP addresses for it's routers throughout the world.
You could also buy or find a Geo IP database and use it too
Let me elaborate on that, as it may not be so obvious.
The assigned netblocks will tell you what country an IP address was issued to - nothing more. This list is available for free, though.
There are databases you can purchase that purport to geolocate users to a finer degree - for example, to the state or city level. They do this by "mapping" known routers using probes, by knowing how different providers name their routers, etc. (City names often appear in abbreviated form in router DNS names.)
These database probably provide greater accuracy at the country level as well. But you will have to pay for these databases in most cases, and they still are far from perfect.
Set a cookie.
Upon return, you may direct to the country section based on the cookie, but always provide a navigation back to other countries.
Search engines don't read cookies, so both countries will get slurped up without being (possibly) penalized for any redirecting by IP address.