title: Using a mod_rewrite RewriteRule to pass the referrer into the querystring
body: <p>I am trying to capture the refuring url or the complete html link
  i.e."(http.bbserver.edu/john_doe/quiz.doc)"
  and send it to a php script.</p>
  
  <p>I've got it to slightly work with the following </p>
  
  <pre><code>REWRITERULE ([^/]+)/([^/]+)$ login.php?referer=%{HTTP_REFERER}&amp;path=$0&amp;folder=$1&amp;file=$2 [NC,L]
  </code></pre>
  
  <p>But the php file prints out this </p>
  
  <pre><code>Referer:
  path: John_Doe/quiz.doc
  folder: John_Doe/quiz.doc
  file: quiz.doc
  </code></pre>
  
  <p>if I try this, attempting to get everything and send it to the php script.</p>
  
  <pre><code>REWRITERULE ^(.+)$ login.php?referer=%{HTTP_REFERER}&amp;path=$0&amp;folder=$1&amp;file=$2 [NC,L]
  </code></pre>
  
  <p>But the php file prints out this.</p>
  
  <pre><code>Referer:
  path: login.php
  folder: login.php
  file:
  </code></pre>
  
  <p>I would like to capture "HTTP_REFERER" and parse the subfolders and file through php.
  But I'm not getting the information I need.</p>