【发布时间】:2011-03-21 18:53:18
【问题描述】:
我正在使用 IIS7.5 作为 Web 服务器的计算机上学习 PHP,但在正确完成 301 重定向时遇到问题。
教程和论坛都说要使用以下内容:
Header('Location: ' . $url, true, 301);
或
Header('Location: ' . $url);
在这两种情况下,浏览器(Chrome 和 Firefox)都会显示以下内容,而不是实际重定向:
Object Moved
This document may be found here
使用 FireFox Web 开发人员工具栏,我检索了页面标题,它们是:
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/7.5
X-Powered-By: PHP/5.3.5, ASP.NET
Date: Mon, 21 Mar 2011 18:47:35 GMT
Content-Length: 123
301 Moved Permanently
为什么页面没有重定向?显示该页面对用户来说有点多余和烦人。
【问题讨论】: