301跳转
header('http/1.1 301 moved permanently'); header('location: http://www.abc.com/aaa/'); exit();
不要漏了header('http/1.1 301 moved permanently'); 不然返回不了301
404错误页面
header(http/1.1 404 not found);
如果上面的不起作用,可以试试下面的:
header(status: 404 not found);
所以为了万无一失,可以两句都写上:
header(http/1.1 404 not found); header(status: 404 not found);
小提示,
如果写好代码之后我们必须使用站长工具来测试一下返回的状态是不是我们想要的哦。
