Page 1 of 1

404 error

Posted: Sun Jul 19, 2009 2:22 pm
by amao
hi all
I need to make customize page to catch any not found page
I edited httpd.conf"C:\wamp\bin\apache\Apache2.2.11\conf"
ErrorDocument 404 /404.php
but did not work any suggestion

Re: 404 error

Posted: Sun Jul 19, 2009 4:07 pm
by califdon
Looks right. Do you have a file "404.php" in your server root directory?

Re: 404 error

Posted: Sun Jul 19, 2009 4:18 pm
by amao
I solve the problem by using .htaccess
but my new problem is I need to know what is the require URL

Re: 404 error

Posted: Sun Jul 19, 2009 6:03 pm
by Darhazer
$_SERVER['REQUEST_URI'] ?

Re: 404 error

Posted: Wed Jul 22, 2009 3:25 pm
by amao
Darhazer wrote:$_SERVER['REQUEST_URI'] ?
it gives me 404.php url but I need the wrong target one,that is my 404.php code

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
   <title>404: Page Not Found</title>
   <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<h1>404: Page Not Found</h1>
<?php
echo "the target url is";   
     $requri = $_SERVER['REQUEST_URI'] ; 
echo $requri;
?>
</body>
</html>
 
 

Re: 404 error

Posted: Wed Jul 22, 2009 3:33 pm
by spider.nick

Code: Select all

$_SERVER['HTTP_REFERER']
Nick

Re: 404 error

Posted: Wed Jul 22, 2009 3:48 pm
by amao
spider.nick wrote:

Code: Select all

$_SERVER['HTTP_REFERER']
Nick
it gives this error
Undefined index: HTTP_REFERER in C:\wamp\www\404.php on line 12

Re: 404 error

Posted: Wed Jul 22, 2009 3:58 pm
by spider.nick
My bad. I misunderstood the question. The following might work:

Code: Select all

echo $_SERVER['PHP_SELF'];
Nick

Re: 404 error

Posted: Wed Jul 22, 2009 4:09 pm
by amao
spider.nick wrote:My bad. I misunderstood the question. The following might work:

Code: Select all

echo $_SERVER['PHP_SELF'];
Nick
it give the url of 404.php

Re: 404 error

Posted: Wed Jul 22, 2009 4:28 pm
by spider.nick
Hmm, perhaps I do not know? Sorry! :crazy:

Nick