Page 1 of 1

404 error page

Posted: Thu Aug 08, 2002 4:48 am
by webmaster
I wanna make a 404 error page that also shows which page is asked for but not found.
I tried with request_uri but it doesn't work.
Someone outthere who can help me with code?
hopefully,

Posted: Thu Aug 08, 2002 4:52 am
by twigletmac
What does your code look like? Which version of PHP are you using?

Mac

Posted: Thu Aug 08, 2002 4:54 am
by webmaster
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

echo("$REQUEST_URI");

?>
</body>
</html>

Apache 1.3.26 ; PHP 4.2.2

Posted: Thu Aug 08, 2002 5:00 am
by twigletmac
Firstly this may be of interest:
http://www.devnetwork.net/forums/viewtopic.php?t=511

Secondly, have you tried:

Code: Select all

echo $_SERVER&#1111;'REQUEST_URI'];
instead of

Code: Select all

echo $REQUEST_URI;
Mac

Posted: Thu Aug 08, 2002 5:03 am
by webmaster
that works, but now it gives the url of the 404-page

Posted: Thu Aug 08, 2002 5:09 am
by twigletmac
Because that's what $_SERVER['REQUEST_URI'] is:
php manual wrote:'REQUEST_URI'
The URI which was given in order to access this page; for instance, '/index.html'.
$_SERVER['HTTP_REFERER'] is probably more what you want:
php manual wrote:'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
All this info is available here:
http://www.php.net/manual/en/reserved.variables.php

Mac

Posted: Thu Aug 08, 2002 5:10 am
by webmaster
thx :o :o :D