HTML: Markup language
CSS: Styling language
JavaScript: Scripting language
Web APIs: Programming interfaces
All web technology
Learn web development
Discover our tools
Get to know MDN better
此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
View in English Always switch to English
HTTP 301 Moved Permanently 说明请求的资源已经被移动到了由 Location 头部指定的 url 上,是固定的不会再改变。搜索引擎会根据该响应修正。
301 Moved Permanently
Location
备注: 尽管规范要求浏览器在收到该响应并进行重定向时不应该修改 http method 和 body,但并非所有的用户代理都符合此要求。所以最好将 301 状态码用作 GET 或 HEAD 方法的响应,而对于 POST 则改用 308 Permanent Redirect,因为此状态码会禁止更改请求方法。
GET
HEAD
POST
308 Permanent Redirect
GET /index.php HTTP/1.1 Host: www.example.org
HTTP/1.1 301 Moved Permanently Location: http://www.example.org/index.asp
308
302