title: Redirects and Referers
body: <p>My actual implementation of this is much more complicated, with authentication and a bunch of other stuff, but at the simplest form, here's the problem I'm having. Redirecting with header doesn't reveal itself as a referer.</p>
  
  <p>So, let's say I have three pages: start.php, middle.php and end.php</p>
  
  <p>start.php</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;
  &lt;a href="middle.php"&gt;middle&lt;/a&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>middle.php</p>
  
  <pre><code>&lt;?php
  header('Location: end.php');
  ?&gt;
  </code></pre>
  
  <p>end.php</p>
  
  <pre><code>&lt;?php
      echo 'The referer is: ' . $_SERVER['HTTP_REFERER'];
  ?&gt;
  </code></pre>
  
  <p>When you follow the link, you end up at end.php, but the referer is not middle.php. Is there any other redirection method I can use to correct this, or anything else I can do?</p>
  
  <p>Cheers</p>
  
  <p><strong>EDIT</strong>
  In this case, the destination page is a third party vendor. The only method they have to validate is from refering URL. I have no control over that. I just need my page that does the redirect to send the proper URL. Are there any alternatives to this redirection method, rather than picking apart the reasons not to trust http_referer?</p>