我一直在尝试做一个适当的301重定向,但是失败了。不管我怎么尝试,它总是302重定向。
返回一个302:
http_redirect("urlgoeshere", '', false, HTTP_REDIRECT_PERM)返回一个302:
header("HTTP/1.1 301 Moved Permanently");
header("Location: urlgoeshere");谁能解释一下为什么这些是302的而不是301的?服务器操作系统为linux,运行PHP/5.2.14。你自己试试吧。
我会给你们一个网址让你们试试。我正在使用YSlow和谷歌机器人进行测试。
应该是301:http://www.fantasysp.com/player/mlb/Albert_Pujols/1486349

发布于 2011-03-11 10:58:13
实际上非常简单:
header('Location: ' . $url, true, 301);

如果您使用的是FastCGI,请尝试这样做:
header('Status: 301 Moved Permanently', true);
header('Location: ' . $url); // or header('Location: ' . $url, true, 301);https://stackoverflow.com/questions/5268454
复制相似问题