Forum Moderators: phranque
PHP has some reserved variables from which you can retrieve the requested page.
Use $SERVER_NAME to get www.mydomain.com and use $REQUEST_URI for the requested page, e.g. /non-existing-page.html.
Also see [php.net...]
Regards,
Arjan
$thisDir = $_SERVER['PHP_SELF'];
$thisFile = basename ($thisDir);
but when apache gets a request for a page that doesn't exist, it automatically sends back the default 404 page, which is an .html page. Even if I cutomized it to be a .php page, how would I get the ORIGINAL requested page that triggered the 404 page to be passed to it as a var? Or more simply, how can I get apache to pass a variable to the 404 page, letting that page know what was originally requested. Something like
/404.php?orignal_request=missing_file.php
What I want to do is perform some string operations on the original (not found) file to offer some recommendations to the user as to how to get to similar files in the site.
Ideas anyone?
I'm not sure about the scope of this variable, but it may be possible to pass it out of mod_rewrite and capture it in your "recommendations" script.
Jim