Codice PHP:
if($_SERVER['HTTP_REFERER']=="URL_di_C"
   exit(); 
else 
header("location: URL_di_C");