Portal Home > Knowledgebase > Articles Database > redirect html pages based on region


redirect html pages based on region




Posted by m-matt, 06-24-2008, 02:59 AM
Guys, How pages can be redirected based on the region. Like, i have a page named index-en.htm only for United States and index-de.htm to Dutch region. How this can be attained, any DNS tricks or simple scripts? Thank You

Posted by artofmobile, 06-24-2008, 10:33 AM
First thing first you need a database of IP corresponding to nation. Then, based of the nation's IP, you redirect it to different html content. For a start, take a look at this URL at: http://www.ip2nation.com/ It will provide you with a database for converting IP address to nation.

Posted by freedman, 06-24-2008, 01:19 PM
I'd start here: sourceforge.net/projects/geoip/ there are lots of places out there where you can find code to interface with the maxmind geoIP database. it seems to be the most complete. They have free and paid versions depending on the level of accuracy you're after.

Posted by m-matt, 06-25-2008, 02:36 AM
ip2nation.com/ sounds good. But how can i direct the page visit according to the database? how to include URL rewrite?

Posted by m-matt, 06-25-2008, 02:38 AM
my mistake!! I didn't see the sample scripts page. Thank you 'artofmobile'. I will try this and update thread. Thank you soooo much Have a nice day!

Posted by freedman, 06-25-2008, 02:38 AM
well.. basically you have to do a curl call to their database to determine the country, then send a location header back. So this couldn't be done via .htaccess, you'd have to code your index page in php or perl to do the logic and issue the redirect header.

Posted by m-matt, 06-25-2008, 02:42 AM
That is correct. Thank you freedman



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
PHP Vs ASP.net (Views: 703)


Language: