使用php跟踪内部推荐的最佳方法是什么?

$_SERVER['HTTP_REFERER'] seems to be full of holes.

Tracking through the url will not be possible for this particular application.

I have a 301 Redirect to take into account also.

I will check $_SERVER['HTTP_REFERER'], but what is a good second method to check what page on my site the user came from?

Is it as simple as setting up a session variable? I am looking for specific examples that will help augment $_SERVER['HTTP_REFERER'].

If $_SERVER['HTTP_REFERER'] is not sufficient, you can keep track of each script as you visit it with a $_SESSION variable, or set cookies on each page. I'd go with the session - you can track scripts on the backend that the browser may not know about and it'll work even if the user has cookies disabled. You could even keep a whole array of executed scripts, adding on the latest as the execution path makes it's way through your scripts. You'd be able to trace the path from arrival to current script.