【发布时间】:2013-01-09 04:06:48
【问题描述】:
我有以下代码用于执行重定向。如果我的$includeFile 不存在,它将重定向到 404 页面。这是我的index.phpsn-p
if ( !file_exists($includeFile) )
Header( "HTTP/1.1 404 Page Not Found" );
Header( "Location: http://legascy.com/404_error/");
但http://legascy.com/404_error/ 显示 HTTP 状态 200 OK 而不是 404。
如何解决?
【问题讨论】:
-
查看此 SO 帖子 Sending a 404 error in PHP
-
您是否手动导航到
http://legascy.com/404_error/,例如,您是否在浏览器中输入该 URL?如果是这样,那应该(正确地)返回 200 OK,因为该页面 确实 存在。
标签: php redirect seo http-headers http-status-code-404