title: How to get .htaccess to attach REQUEST_URI to 404 page
body: <p>Is there a way to send the request URI along to the 404 page as a URL variable? For instance, if I forward my 404's with an <code>ErrorDocument</code> directive, is there a way to do something like this? This is the code I tried but it obviously didn't work.</p>
  
  <pre><code>ErrorDocument 404 /pages/errors/index.php?e=404&amp;url=%{REQUEST_URI}
  </code></pre>
  
  <p>I also tried a mod_rewrite, but I couldn't get that working either. Here is what I tried with mod_rewrite:</p>
  
  <pre><code>Options +FollowSymLinks
  RewriteEngine On
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule .* /pages/errors/index.php?e=404&amp;url=%{REQUEST_URI} [L,R=404]
  </code></pre>
  
  <p>Basically all I'm trying to do is so that when a user types in something like <code>http://mysite.com/asdf</code> then it forwards to <code>http://mysite.com/pages/errors/index.php?e=404&amp;url=/asdf</code> assuming that the directory <code>/asdf</code> does not exist on the server.</p>
  
  <p>Is there an easy way to achieve this?</p>