[thelist] [php] Redirect causing error 500

Eduardo Dominguez lalo at teligens.com
Wed Feb 18 14:38:32 CST 2004

Joshua Olson wrote:

> Eduardo,
> Thank you for the advise.  I've changed the code to this:
> <?
>   error_reporting(E_ALL);
>   header("HTTP/1.1 301 Moved Permanently");
>   header("Location: http://www.domain.com/");
>   exit();
> ?>
> The error message did not change.
> After a bit of commenting, I've isolated the problem down to one line:
>   header("HTTP/1.1 301 Moved Permanently");

Its crazy how a program this small gives such problems. Try to see if 
the webserver is not somehow sending other headers by itself. You can 
test it with the Web Developer toolbar[1] or the LiveHTttp headers[2], 
both mozilla's extensions.

1.- http://chrispederick.myacen.com/work/firefox/webdeveloper/
2.- http://livehttpheaders.mozdev.org/

Reading the php manual found that you can also try:

   header("Status: 303");

after the Location header.

Good luck.

More information about the thelist mailing list