Aşağıdaki yapı ile yapabilirsin bunu;

if (strtolower($_SERVER['HTTP_REFERER']) == 'http://www.example.com/') {...}