301 永久重定向
新地址由 location 项指示404 页面不存在

解决方案 »

  1.   

    版主可能没明白我的意思,正常xx.com/4545456454 这是个无效路径,正常应该要返回的是404页面,可是我的网站返的是301。
      

  2.   

    我没有不明白你的意思
    301 是按照域名跳转的,等转到 Location: http://www.10086fj.net 后,才会有 404先看$url = 'http://10086fj.net/';
    print_r(get_headers($url));Array
    (
        [0] => HTTP/1.1 301 Moved Permanently  !先是 301 跳转
        [1] => Content-Type: text/html; charset=UTF-8
        [2] => Location: http://www.10086fj.net/  !目标地址
        [3] => Server: Microsoft-IIS/7.5
        [4] => X-Powered-By: ASP.NET
        [5] => Date: Thu, 31 Jul 2014 07:59:21 GMT
        [6] => Connection: close
        [7] => Content-Length: 146
        [8] => HTTP/1.1 200 OK   !正常到达
        [9] => Content-Type: text/html; charset=gb2312
        [10] => Server: Microsoft-IIS/7.5
        [11] => X-Powered-By: PHP/5.2.17
        [12] => X-Powered-By: ASP.NET
        [13] => Date: Thu, 31 Jul 2014 07:59:24 GMT
        [14] => Connection: close
        [15] => Content-Length: 17690
    )再看$url = 'http://10086fj.net/123';
    print_r(get_headers($url));Array
    (
        [0] => HTTP/1.1 301 Moved Permanently   !先是 301 跳转
        [1] => Content-Type: text/html; charset=UTF-8
        [2] => Location: http://www.10086fj.net/123
        [3] => Server: Microsoft-IIS/7.5
        [4] => X-Powered-By: ASP.NET
        [5] => Date: Thu, 31 Jul 2014 08:02:24 GMT
        [6] => Connection: close
        [7] => Content-Length: 149
        [8] => HTTP/1.1 404 Not Found  !到达后出错
        [9] => Cache-Control: private
        [10] => Content-Type: text/html; charset=utf-8
        [11] => Server: Microsoft-IIS/7.5
        [12] => X-Powered-By: ASP.NET
        [13] => Date: Thu, 31 Jul 2014 08:02:24 GMT
        [14] => Connection: close
        [15] => Content-Length: 5092
    )
      

  3.   

    get_headers(url)
    不就可以返回参数?
      

  4.   

    你 http://www.10086fj.net/123 他不就直接 404 了吗?