Support » Plugin: Custom Content by Country (by One Dollar Plugin) » How to redirect traffic based on IP

  • Hi,

    what’s the correct code to redirect traffic based on IP with your plugin. I tried like that but it didn’t work.

    <?php
    $country_code = $_SERVER[“HTTP_CF_IPCOUNTRY”];

    if($country_code==”us”){
    header(“Location: http://xxx.org/xxx/ “);
    }
    else
    {
    header(“Location: http://xxxx/xxxx.com “);
    }
    ?>

    Thank you,
    Mark

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Paul

    (@paultgoodchild)

    The code here isn’t specific to this plugin, but rather CloudFlare.

    This plugin isn’t designed to expose this sort of geo information in this sort of way, but we will be developing this in the future.

    ah. ok.

    so i can’t pull the visitor IP in some way to use it like with cloudflare?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to redirect traffic based on IP’ is closed to new replies.