You are here: 404 Header Problems « PHP « IT news, forums, messages
404 Header Problems

Posted by Scott Taylor on 07/13/05 23:01

I'm trying to issue a 404 header on one of my pages. But it does not
redirect. I figured, with many function calls before it, that it might
be outputting something to the screen before the header() command was
issued. So, I tried issuing a 404 header from a new page, consisting of
this code:

<?
header("HTTP/1.0 404 Not Found");
exit();
?>

or
<?
header("HTTP/1.0 404 Not Found");
?>

But neither of these work. Notice how there should also be no ouput to
the screen before the header is closed.

I've also tried:

<?
|header("Status: 404 Not Found");
?>

which gives the same results. The results are this: an output of
<html><head></head></html>. I'm on a large shared server, and my guess
is that when there is a bug with some code in php, the server chooses to
ouput this instead of the actual error code(s). I've experienced this
many times when I upload a page and there is a simple syntax error such
as one semi-colon missing from a statment. This is probably so that the
server doesn't get hacked.


If I try to issue both commands, in either order, I get this:


Not Found

The requested URL /cgi-sys/php.cgi/testing_server/404_error.php was not
found on this server.

Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.

So....what's going on here? Am I to conclude that the 404 header does
not work, and that I should just use a Redirect: header() to my 404 page?

Best Regards,

Scott Taylor

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация