Thanks to visit codestin.com
Credit goes to developer.mozilla.org

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

301 Moved Permanently

HTTP 301 Moved Permanently 说明请求的资源已经被移动到了由 Location 头部指定的 url 上,是固定的不会再改变。搜索引擎会根据该响应修正。

备注:尽管规范要求浏览器在收到该响应并进行重定向时不应该修改 http method 和 body,但并非所有的用户代理都符合此要求。所以最好将 301 状态码用作 GETHEAD 方法的响应,而对于 POST 则改用 308 Permanent Redirect,因为此状态码会禁止更改请求方法。

状态

http
301 Moved Permanently

示例

客户端请求

http
GET /index.php HTTP/1.1
Host: www.example.org

服务端响应

http
HTTP/1.1 301 Moved Permanently
Location: http://www.example.org/index.asp

规范

Specification
HTTP Semantics
# status.301

参见

  • 308,当使用的请求方法永远不会更改时,等价于此状态代码。
  • 302,临时重定向