(Status-Line) HTTP/1.1 404 Not Found
这个是文件不存在header给IE的信息
我试着在404.php中加入
header ('(Status-Line): HTTP/1.1 200');
输出信息
(Status-Line) HTTP/1.1 404 Not Found
(Status-Line) HTTP/1.1 200
Connection Keep-Alive
Content-Type text/html
Date Sat, 22 May 2010 18:08:28 GMT
Keep-Alive timeout=15, max=100
Server Apache/2.0.63 (Win32) PHP/5.2.10
Transfer-Encoding chunked
X-Powered-By PHP/5.2.10我希望404页面反馈给IE的信息是HTTP/1.1 200而不是HTTP/1.1 404 Not Found
这里头虽然有了200但IE只识别第一个提供的信息404文件不存在
改怎么做 是否可以改变?

解决方案 »

  1.   

    在404.php中加入header ('HTTP/1.1 200');我在我的windows搭建的
    Apache/2.0.63 (Win32) PHP/5.2.10
    环境下可以正常
    但在其他环境下都是依然显示404错误
    Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635但是使用301header ('HTTP/1.1 301');
    却可以下面是GOOGlE成功抓取到的HTTP头信息
    HTTP/1.1 301 Moved Permanently
    Date: Sun, 23 May 2010 01:10:41 GMT
    Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
    X-Powered-By: PHP/5.2.11
    Content-Length: 14087
    Keep-Alive: timeout=5, max=100
    Connection: Keep-Alive
    Content-Type: text/html
      

  2.   


    static function sendHeader($num,$rtarr=NULL){
    $sapi = php_sapi_name();
    $header_a = array(
    '200' => 'OK',
    '206' => 'Partial Content',
    '304' => 'Not Modified',
    '404' => '404 Not Found',
    '416' => 'Requested Range Not Satisfiable',
    );
    if ($header_a[$num]) {
    if ($sapi=='cgi' || $sapi=='cgi-fcgi') {
    $headermsg = "Status: $num ".$header_a[$num];
    } else {
    $headermsg = "HTTP/1.1: $num ".$header_a[$num];
    }
    if (empty($rtarr)) {
    header($headermsg);
    } else {
    return $headermsg;
    }
    }
    return '';
    }