Sorry for the confusing/vague question title. I couldn’t come up with a better one.
THE SITUATION
Suppose a page abc.php has a set of anchor tags.
<a href="xxx.php">AAA</a>
<a href="xxx.php">BBB</a>
<a href="xxx.php">CCC</a>
If I click on BBB, is there way to find out inside xxx.php that BBB was the link which brought it here? In the same way if CCC is clicked, can it be known in xxx.php that the redirection took place because of CCC link?
In a nutshell, I’m looking for a set of links redirecting to a single page and in that page determine which link caused the redirection.
PS : I know I can do that using query strings but I would prefer to avoid them as much as possible. Also I would also like it to be in PHP only (if possible, i.e. server side; something like $_SERVER['HTTP_REFERER']).
If you don’t want to expose query strings on the client (I don’t see a reason for avoiding them for the scope of your problem) an you want all to be performed on the server side you can try using the rewriting rules on Apache.
Something like
And rewrite a rule in your .htaccess like:
And within your script you could know where it came with
Yes, at the end you are using a query string even if you are not exposing it, but solutions like $_SERVER[‘HTTP_REFERER’] will not work.