This is raw copy from my notes during magento store upgrade.

=======================================
Restrict access to /index.php with IP Address whitelist.
This is what I have:
if (file_exists($maintenanceFile)) {
// START IP BLOCKER
// Remove file 'maintenance.flag' when you decide to go live
$ip_whitelist = array('x.x.x.x', '127.0.0.1', 'x.x.x.x');
if(!in_array($_SERVER['REMOTE_ADDR'], $ip_whitelist)) {
$protocol = "HTTP/1.0";
if ( "HTTP/1.1" == $_SERVER["SERVER_PROTOCOL"] )
$protocol = "HTTP/1.1";
header( "$protocol 503 Service Unavailable", true, 503 );
header( "Retry-After: 3600" );
header('Location: /index_landingpage.php'); // our own custom landing page.
exit;
}
// END IP BLOCKER
include_once dirname(__FILE__) . '/errors/503.php';
exit;
}