Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 504799

How to redirect traffic based on IP

$
0
0

Replies: 0

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 all articles
Browse latest Browse all 504799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>