How can we Restrict to access a certain wordpress page to all ip address except some which we allow

Haven’t specifically done this yet but something similar

In the theme page/post template files you can get post id of current post/page by doing

$currentID = get_the_ID();

Then redirect all traffic not from the specified IPs

$ipArr = array('xx.xxx.xxx.xxx', 'xx.xxx.xxx.xxx');

 if (!in_array(@$_SERVER['REMOTE_ADDR'], $ipArr))
{
    header("Location: http://example.com/myhomepage");
    die();
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)