if(isset($_SERVER['HTTP_REFERER']))
$referer_host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
else
$referer_host = '';
if($referer_host != 'example.com')
{
header('Location: http://example.com/error');
exit;
}
People not sending (correct) referers for various reasons will be entirely excluded from your page.
Of course bookmarking your site etc. will also not work.
As headers can be faked by the client at will, I would not call this a "security" feature.