i found this question on quora and didn’t know how to resolve it
Scenario —
User is on one.php and clicks a link that points to two.php
Two.php does a header redirect to three.php
If we check the referring URL on three.php $_SERVER shows one.php instead of two.php
How do we find out that two.php was an intermediate page that did a header redirect?
Note that I can not do anything with one.php or two.php that can include any params saying two.php included in the redirect
Save the Record with Sessions
You can save the stack on a session variable. Just keep unshifting values onto
$_SESSION["history"], removing items from the end of the array when the collection grows to a certain size.For instance:
Load it into all PHP files
This would need to be added to the top of each file, or to a global header template include if you have one. Alternatively, if you dare, you could load it globally using
auto_prepend_file:Inspect the History
You could show the entire history by accessing
$_SESSION["history"]: