phphtmlurlreferer

How to add ?ref to url from other websites?


I'm curious in knowing how websites manage to add ?ref to their URLS when being referred from another site? Is this something both websites have to add into their code? How does this work?


Solution

  • Option 1

    Both sites implement code for it so site A can track if someone clicks a link to them from site B.

    Option 2

    Site A implements a catch all address that gets linked to, then gets the referrer from the request header, appends this to the url and redirects to the page the user wanted to go to originally (or uses the referrer directly without showing it in the URL)