Custom Redirect Page

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
My hosting company has an automatic redirect page called
/missing/missing.php and I want to log all of the page not founds that
result in a redirection to missing.php.  I can't seem to find out how
to get the string that the web user typed to get there.  I have
checked $_SERVER['REDIRECT_URI'] but it has /missing/missing.php and
$_SERVER['HTTP_REFERER'] is empty.  Does anyone know how to get
"/abcdef" if the user navigated to " " ? Any
help is appreciated.


Re: Custom Redirect Page

Hi Sean,

URL of the page that wasn't found:

Query string submitted to the page that wasn't found:

URL that referred the visitor to the page that wasn't found:

The above probably won't work if your site is configured to *redirect*
requests for non-existent documents to the error page--that is, if it sends
a redirect header to the browser pointing to /missing.php. When the user
visits a "real" error page (vs. a redirected to on error page), they are not
redirected--the error message is displayed at the bad URL. To configure
things as such with Apache, insert:
ErrorDocument 404 /scripts/not_found.php
into .htaccess (assuming your server's config allows that directive in

Have a great day!

Ben :-)
Ben Gribaudo - Baltimore, MD -

"For God so loved the world, that he gave his only begotten Son, that
whosoever believeth in him should not perish, but have everlasting life."
John 3:16

Quoted text here. Click to load it

Re: Custom Redirect Page

Sean Pinto wrote:

Quoted text here. Click to load it

And what status code is returned to the client? It should be 404 for a
not found page.

Quoted text here. Click to load it

Use the server's mechanism for a customized error document. For
Apache, use

ErrorDocument 404 //missing/missing.php

That will provide users your php "missing" script and the correct 404
status code.

Brian (remove ".invalid" to email me) /

Site Timeline