Loading AI tools
来自维基百科,自由的百科全书
HTTP Location 是在两种情况下,因来自HTTP服务器的响应中返回头域:
HTTP 1.1规范(IETF RFC 2616)的过时版本需要完整的重定向URI。[2] IETF HTTP工作组发现,最受欢迎的Web浏览器允许传递相对URL(relative URL)[3] 。因此,更新后的HTTP 1.1规范(IETF RFC 7231)放宽了原始的约束,允许在位置标题中使用相对URL。[4]
绝对URL是一种以方案为头的URL[5] (例如:http:,https:,telnet:,mailto:)[6] ,并符合方案特定的语法和语义。 例如HTTP URL特定于HTTP方案的语法和语义需要用“主机”(Web服务器地址)和“绝对路径”,其中可选元件为“端口”和“查询”。
例如,客户端请求:
GET /index.html HTTP/1.1
Host: www.example.com
服务器回应:
HTTP/1.1 302 Found
Location: http://www.example.org/index.php
该位置的URL被客户端重定向到http://www.example.org/index.php.
相对URL是不包含方案或主机的URL。为了理解,它们必须与原始请求的URL相结合。例如,客户端请求:
GET /blog HTTP/1.1
Host: www.example.com
服务器回应:
HTTP/1.1 302 Found
Location: /articles/
该位置的URL被客户端扩展为http://www.example.com/articles/.
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.