$domain="proxywebsite.com"; // Change this to your domain (no 'www.') $domain2="proxy.org"; if($_GET['q']!=""){ // If no request: $referer=$_SERVER['HTTP_REFERER']; // Get referer $count=substr_count($referer,$domain); // Check to see if referer is not the proxys domain $count2=substr_count($referer,$domain2); // Check to see if referer is not the proxy.org if($count!=1 && $count2!=1){ // If there is an outside referer: if($_GET['q']!=""){ // If there is a request: header("Location: http://www." . $domain . "/"); // Redirect to homepage and finish script exit(); } } }