In these circumstances, I normally create a file named /includes/extra_datafiles/test_site.php containing:
Code:
<?php
// -----
// This script checks to see if the current location is running the 'live' site. If not,
// override various API keys to use the test versions.
//
if (HTTP_SERVER . DIR_WS_CATALOG != 'https://example.com') {
$allowed_ips = array(
//-a list of IP addresses that are allowed to access the test site
);
if (!isset($_SERVER['REMOTE_ADDR']) || !in_array($_SERVER['REMOTE_ADDR'], $allowed_ips)) {
die();
}
}
Note that the code above presumes that the site's running SSL-all-the-time. Just replace example.com with your site's URL and add the list of IP addresses that can access the test site.
You can also use this file to override database-configuration settings via PHP define statements.
Bookmarks