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 ErrorDocument
directive, is there a way to do something like this? This is the code I tried but it obviously didn't work.
ErrorDocument 404 /pages/errors/index.php?e=404&url=%{REQUEST_URI}
I also tried a mod_rewrite, but I couldn't get that working either. Here is what I tried with mod_rewrite:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /pages/errors/index.php?e=404&url=%{REQUEST_URI} [L,R=404]
Basically all I'm trying to do is so that when a user types in something like http://mysite.com/asdf
then it forwards to http://mysite.com/pages/errors/index.php?e=404&url=/asdf
assuming that the directory /asdf
does not exist on the server.
Is there an easy way to achieve this?