HTTP_REFERER isn't reliable. Some proxies strip it. And if you do manage to get an HTTP_REFERER, you'll want to examine it before using it, since redirecting someone to a Google search isn't the same as using the browser's Back button to back into a cached result page