我正在编写一个PHP代码,并且有header('Location: '.$location, TRUE, 200);
,它没有重定向到$location
(此处的值为"https://thepiratebay.se/")。我已经列出了所有的标题,请帮忙。
正如您所看到的,Location
标头存在,但没有重定向到。为什么?
测试浏览器:Chrome,Firefox,IE,Safari。
标题为(如Chrome所示):
HTTP/1.1 200 OK
Date: Sat, 25 Aug 2012 15:10:54 GMT
Server: Apache/2.4.2 (Win32) PHP/5.4.4
X-Powered-By: PHP/5.4.4
Location: https://thepiratebay.se/
Content-Length: 5935
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
您的错误是200
响应代码。
更改此行:
header('Location: '.$location, TRUE, 200);
成为
header('Location: '.$location, TRUE, $code);
其中$code
是301或302(永久移动与临时移动)。