WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

You could try using:


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=' );

I hope this helps.

share|improve this answer
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

Your Answer


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.