|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-08-14 19:16 UTC] jani@php.net
[2008-08-22 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 19:00:02 2025 UTC |
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/