404 error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amao
Forum Newbie
Posts: 21
Joined: Sun May 10, 2009 5:13 am

404 error

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: 404 error

Post by califdon »

Looks right. Do you have a file "404.php" in your server root directory?
amao
Forum Newbie
Posts: 21
Joined: Sun May 10, 2009 5:13 am

Re: 404 error

Post by amao »

I solve the problem by using .htaccess
but my new problem is I need to know what is the require URL
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: 404 error

Post by Darhazer »

$_SERVER['REQUEST_URI'] ?
amao
Forum Newbie
Posts: 21
Joined: Sun May 10, 2009 5:13 am

Re: 404 error

Post 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>
 
 
spider.nick
Forum Commoner
Posts: 72
Joined: Wed Jul 15, 2009 12:22 pm
Location: Overland Park, KS

Re: 404 error

Post by spider.nick »

Code: Select all

$_SERVER['HTTP_REFERER']
Nick
amao
Forum Newbie
Posts: 21
Joined: Sun May 10, 2009 5:13 am

Re: 404 error

Post 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
spider.nick
Forum Commoner
Posts: 72
Joined: Wed Jul 15, 2009 12:22 pm
Location: Overland Park, KS

Re: 404 error

Post by spider.nick »

My bad. I misunderstood the question. The following might work:

Code: Select all

echo $_SERVER['PHP_SELF'];
Nick
amao
Forum Newbie
Posts: 21
Joined: Sun May 10, 2009 5:13 am

Re: 404 error

Post 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
spider.nick
Forum Commoner
Posts: 72
Joined: Wed Jul 15, 2009 12:22 pm
Location: Overland Park, KS

Re: 404 error

Post by spider.nick »

Hmm, perhaps I do not know? Sorry! :crazy:

Nick
Post Reply