Maybe you have a bunch of high-volume sites and you want them never to go down? You could get a couple dedicated servers and install Apache and your sites on them. If ever your main server goes down, your plan could be to switch the DNS for your sites over to these DR servers.

How do you test that your sites (set up with VirtualHosts) on these servers work, BEFORE you have to switch them over?

Well, you’d add the new IPs to your local hosts file and test it. But what if you wanted on going tests, maybe with Selenium? Well, you could use a proxy and add the lines to the proxy’s /etc/hosts UNLESS you needed to test the same site on multiple servers. If that was your scenario, you could do the following:

1. install glypeproxy ( ) which is free for non-commercial use
2. in browse.php, after require ‘includes/init.php’; add:

if (isset($_REQUEST['hostHack']))
header("Location: $sessionfixurl");

3. add a new file called hosthack.php:

if (isset($_REQUEST['goto']))
$_SESSION = array();
if (isset($_REQUEST['goto']))
if ($proxyip!='')
header("Location: $url");

4. in includes/settings.php add (after stripObjects):

'hostHack' => array('title' => 'Host Hack',
                        'default' => false,
                        'desc' => 'use a proxy IP for the host name')

5. in themes/default/main.php add this javascript code:

var xmlHttp = null;
function updateLocationFirst(pointer)
xmlHttp = new XMLHttpRequest();
url="http://YOURURLHERE/hosthack.php?hostHack="+hostHack+"&hostHackIP="+hostHackIP; "GET", url, true );
xmlHttp.send( null );
return updateLocation(pointer);

6. in that same file, modify the onsubmit to be:

return updateLocationFirst(this);

7. in that same file, right after foreach ( $toShow as $option ), add:

if ($option['name']=='hostHack') echo("<input name=hostHackIP type=text id=\"hostHackIP\"/>");

8. oh, and in browse, right before curl_setopt_array, add:

if (strpos($this->URL,"https")!== false) $port="443";
if ($_SESSION['hostHack']&&$_SESSION['hostHackIP'])

And there you have it. Now the options box will present a hosthack option (what some call the process of overriding DNS by adding a line to /etc/hosts, or in our case, using the proxy method of php’s curl) alongside a box for an IP. If you want to send a hosthacked proxed link, simply postfix &hostHack=true&hostHackIP=THEIP to the end of your glype encoded URL