Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want that visitors out of my country would be redirected to www.mysite.com/en. How I can do this in Wordpress?

share|improve this question
add comment

migrated from stackoverflow.com Nov 3 '11 at 14:13

This question came from our site for professional and enthusiast programmers.

1 Answer

You could try using:

http://ipinfodb.com/ip_location_api.php

Send a get with the incoming ip adress and based on the response redirect it to a different part of your website.

$request = new WP_Http;
$result = $request->request( 'http://api.ipinfodb.com/v3/ip-country/?key=<your_api_key>&ip=74.125.45.100' );

I hope this helps.

share|improve this answer
1  
As an addendum, the OP would want to use the init hook and place the code in that. Also, use wp_redirect() function to redirect the user. –  v0idless Nov 3 '11 at 14:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.