PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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.
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
}