#45818 [Opn->Fbk]: Header location not work in 404 error page with Nginx
ID: 45818
Updated by: jani@php.net
Reported By: macroz at gmail dot com
-Status: Open
+Status: Feedback
-Bug Type: Other web server
+Bug Type: CGI related
Operating System: cent os 5
PHP Version: 5.2.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
Previous Comments:
------------------------------------------------------------------------
[2008-08-14 08:56:01] macroz at gmail dot com
Description:
------------
Code header(Location:url) in 404 error page not work with nginx.
My webserver is Nginx 0.7.10 + php-fastcgi 5.2.6
Nginx conf code:
error_page 404 /404.php;
Code in 404.php:
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.abc.com/");
?>
Curl -I a not exists file results (Nginx 0.7.10 + php-fastcgi 5.2.6)
curl -I http://www.abc.com/120.html
HTTP/1.1 404 Not Found
Server: nginx/0.7.10
Date: Thu, 14 Aug 2008 08:46:45 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.2.6
Location: http://www.abc.com/
This is work in apache+mod_php.
Curl -I a not exists file results (apache + mod_php)
curl -I http://www.abc.com/120.html
HTTP/1.1 301 Moved Permanently
Date: Thu, 14 Aug 2008 09:08:41 GMT
Server: Apache
X-Powered-By: PHP/5.2.5
location: http://www.abc.com/
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
Reproduce code:
---------------
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.abc.com/");
?>
Expected result:
----------------
It will be location to http://www.abc.com/ when visite a not exist
page.
Actual result:
--------------
Not location to http://www.abc.com/
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45818&edit=1
Thread (2 messages)