I did it in the end. putting the exception ip in an array means i can add as many as i want. also, the $uri
means it will go to the same path upon redirect:
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/geoip/geoip.inc");
$gi = geoip_open($_SERVER['DOCUMENT_ROOT']."/geoip/GeoIP.dat", GEOIP_MEMORY_CACHE);
$country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);
$useragent_country = array('gb');
$uri = $_SERVER['REQUEST_URI'];
$exception_ip = array("1.2.3.4.5");//ADD IPs here in array form
if(in_array($_SERVER['REMOTE_ADDR'], $exception_ip)){
//do nothing
}
else{
if (in_array(strtolower($country), $useragent_country)){
header('location: http://www.mysite.co.uk$uri');//redirect to same path
exit();
}
}
?>