Discuss managing REQUEST_URI in case of 404 errors in the Apache Development forum on Dev Shed. managing REQUEST_URI in case of 404 errors Apache Development forum discussing HTTP Server general topics, configuration, and modules. Apache is an open source web server that runs on multiple platforms.
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
How to get the requested page when the requested page is a 'page not found' (404)?
Hello everybody,
I know I can personalize the 404 error page with my own's errors page or with a message, inserting the following line in the .htaccess file in the website-root directory:
ErrorDocument 404 http://www.myownsite.tld/errors.php
Well, but how can I do to pass the REQUEST_URI to such an URL, i.e. what am I to write in the .htaccess page in order to redirect user to a page that contains the REQUEST_URI in its URL (as a variable), e.g.: http://www.myownsite.tld/errors.php?request={REQUEST_URI}
Since I wrote a statistics service in php, I need to pass it the REQUEST_URI.
Thanks in advance to those who will answer me!
Aldo Medri
URL
Last edited by webguide : April 5th, 2001 at 12:22 PM.
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
I meant a different thing
Sorry, I meant a different thing, so I'll try to explain better.
If a visitor tries to go to www.myownsite.tld/dfhytjhdjhtfhjfjhfdhjhj , since this URL (this internal path) does not exist, thanks to the .htaccess file, the visitor does not view the browser's 404 error page, but he is redirected to the page I desire, and this page could be, e.g., /404.php.
The referrer is another thing: it's the page the visitor comes from.
But if one tries to go to a page which does not exist, and if the server redirects the user to another page, what I want to catch is WHAT PAGE did the user searche for? And NOT what page he comes from.
So I want that php could know what the user wrote (the REQUEST_URI) to get the /404.php page, and not what page he came from.
Thanks for the suggestion, but I meant a different thing... I hope you can help me...
Posts: 31
Time spent in forums: < 1 sec
Reputation Power: 11
what you can do : put an <i> echo phpinfo () </i> into 404.php.
it lists all the environment variables that are available to your script. look for the one which contains the originally requested page.
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you, freebsd, but unfortunately it does not work.
Are you sure you can do it with a file with extensio .html, or I need another extension (I tries with .shtml, but it does not work the same.
I think you used a server-side language.
I tried to use $REQUEST_URI in php but it does not works (it gives me the URL about the 404.php page, not the one about the file reqested by the user.
How can I do?