Page 1 of 1

Custom 404 Error Messages

Posted: Sun Apr 04, 2004 9:28 pm
by rapaddict_dot_com
I have a custom 404 script and I wanna make it so it says

you were refered from : blah blah

and I want the address bar to have the address to the page they were trying to find

how can I do this?

Posted: Sun Apr 04, 2004 10:06 pm
by Illusionist
1) i really don't think this is the appropriate forum, but i have no power over that
2) to get the referrer, try:

Code: Select all

$ref = $_SERVER['HTTP_REFERRER'];
3) address abr to have teh address to the page they were trying to find?? How are you going to do that? read their mind?

Posted: Sun Apr 04, 2004 10:15 pm
by markl999
If you use the apache directive ErrorDocument 404 /your404page.php then the address bar should retain the original link they were trying to find. Does for me anyway :o

Posted: Sun Apr 04, 2004 11:31 pm
by rapaddict_dot_com
$ref = $_SERVER['HTTP_REFERRER'];

^that doesnt work for me

Posted: Sun Apr 04, 2004 11:37 pm
by markl999
Should be $_SERVER['HTTP_REFERER']; and it won't always be set, so better do a if(!empty($_SERVER['HTTP_REFERER'])){ ... }

Posted: Mon Apr 05, 2004 2:34 am
by twigletmac
Moved to PHP - Code.

Mac

Posted: Mon Apr 05, 2004 7:13 pm
by rapaddict_dot_com
thanks