Page 1 of 1

Capturing File Not Found data

Posted: Thu Apr 08, 2004 6:01 pm
by Paddy
Hey guys. I did search for this here but I could not find exactly what I needed.

When a user looks for a file that isn't there I would like for the 404.shtml file to redirect them to index.php. As well as redirect them I would also like to capture the URL they typed in so that I can process it at index.php for processing.

Any help would be greatly appreciated even if it is telling me it can't be done so I can stop looking. ;)

Posted: Thu Apr 08, 2004 6:10 pm
by markl999
Either in httpd.conf or a .htaccess you could put
ErrorDocument 404 /index.php

Then in index.php

if (!empty($_SERVER['REDIRECT_STATUS']) && $_SERVER['REDIRECT_STATUS'] == 404){
//$_SERVER['REQUEST_URI'] is the page they originally requested
//do what you want with it here
}

Posted: Thu Apr 08, 2004 6:22 pm
by Paddy
Having your children springs to mind.

Many thanks mate. :)

Posted: Thu Apr 08, 2004 6:26 pm
by d3ad1ysp0rk
o_O

introducing mark, the php pimp.

Posted: Thu Apr 08, 2004 6:35 pm
by markl999
:o