<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=HTTP_Location</id>
	<title>HTTP Location - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=HTTP_Location"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=HTTP_Location&amp;action=history"/>
	<updated>2026-06-25T21:17:32Z</updated>
	<subtitle>在这个wiki上该页的修订历史</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=HTTP_Location&amp;diff=2902389&amp;oldid=prev</id>
		<title>imported&gt;S8321414 来自 2025年7月20日 (日) 13:50</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=HTTP_Location&amp;diff=2902389&amp;oldid=prev"/>
		<updated>2025-07-20T13:50:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{NoteTA|G1=IT}}&lt;br /&gt;
{{HTTP}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HTTP Location&amp;#039;&amp;#039;&amp;#039; 是在兩種情況下，因來自[[超文本传输协议|HTTP]]服務器的響應中返回[[HTTP头字段列表|頭域]]：&lt;br /&gt;
# 要求網頁瀏覽器加載其他網頁（[[網域名稱轉址]]）。在这种情况下，應該使用[[HTTP狀態碼]]3xx發送Location頭（Location header）。當請求的[[统一资源标志符|URI]]具有以下內容時，Web服務器響應傳遞：&lt;br /&gt;
#* 临时移动;&lt;br /&gt;
#* 永久移动；&lt;br /&gt;
#* 處理請求，例如一個POST表單，以一個不同的URI来提供該請求的結果。&lt;br /&gt;
# 提供有關新創建資源位置的信息。在這種情況下，應該使用HTTP狀態碼201或202發送Location頭。&amp;lt;ref name=&amp;quot;RESTful Web Services&amp;quot;&amp;gt;{{Cite book|title=RESTful Web Services|url=https://archive.org/details/RESTfulWebServices|last=Richardson|first=Leonard|publisher=O&amp;#039;Reilly|year=2007|isbn=978-0-596-52926-0|location=Sebastopol|pages=[https://archive.org/details/RESTfulWebServices/page/n253 228]–230}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
HTTP 1.1規範（IETF [[rfc:2616|RFC 2616]]）的過時版本需要完整的重定向URI。&amp;lt;ref name=&amp;quot;rfc2616sec1430&amp;quot;&amp;gt;{{Cite IETF|year=1999|month=June|title=Hypertext Transfer Protocol -- HTTP/1.1|sectionname=Location|rfc=2616|section=14.30|publisher=[[Internet Engineering Task Force|IETF]]}}&amp;lt;/ref&amp;gt; IETF HTTP工作組發現，最受歡迎的Web瀏覽器允許傳遞[[统一资源定位符|相對URL]]（relative URL）&amp;lt;ref name=&amp;quot;httpbisticket185&amp;quot;&amp;gt;{{Cite web |url=http://trac.tools.ietf.org/wg/httpbis/trac/ticket/185 |title=IETF HTTPbis Working Group Ticket 185 |accessdate=2017-06-30 |archive-date=2016-10-13 |archive-url=https://web.archive.org/web/20161013183240/https://trac.tools.ietf.org/wg/httpbis/trac/ticket/185 |dead-url=no }}&amp;lt;/ref&amp;gt; 。因此，更新后的HTTP 1.1規範（IETF [[rfc:7231|RFC 7231]]）放寬了原始的約束，允許在位置標題中使用相對URL。&amp;lt;ref name=&amp;quot;rfc7231sec712&amp;quot;&amp;gt;{{Cite IETF|year=2014|month=June|title=Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content|sectionname=Location|rfc=7231|section=7.1.2|publisher=[[Internet Engineering Task Force|IETF]]}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 例子 ==&lt;br /&gt;
&lt;br /&gt;
=== 	 絕對URL（Absolute URL）示例 ===&lt;br /&gt;
絕對URL是一种以方案为头的URL&amp;lt;ref name=&amp;quot;rfc3986&amp;quot;&amp;gt;{{Cite IETF|year=2005|month=January|title=Uniform Resource Identifier (URI): Generic Syntax|rfc=3986|publisher=[[Internet Engineering Task Force|IETF]]}}&amp;lt;/ref&amp;gt; (例如：&amp;lt;nowiki&amp;gt;http:，https:，telnet:，mailto:&amp;lt;/nowiki&amp;gt;)&amp;lt;ref name=&amp;quot;uri-schemes&amp;quot;&amp;gt;{{Cite web|url=http://www.iana.org/assignments/uri-schemes.html|title=IANA Uniform Resource Identifer (URI) Schemes|accessdate=2014-11-21|author=&amp;lt;!--Staff writer(s); no by-line.--&amp;gt;|last=&amp;lt;!--Staff writer(s); no by-line.--&amp;gt;|archive-date=2010-08-24|archive-url=https://web.archive.org/web/20100824215212/http://www.iana.org/assignments/uri-schemes.html|dead-url=no}}&amp;lt;/ref&amp;gt; ，並符合方案特定的語法和語義。 例如HTTP URL特定於HTTP方案的語法和語義需要用“主機”（Web服務器地址）和“絕對路徑”，其中可選元件為“端口”和“查詢”。&lt;br /&gt;
&lt;br /&gt;
例如，客户端请求:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
GET /index.html HTTP/1.1&lt;br /&gt;
Host: www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
服务器回应:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
HTTP/1.1 302 Found&lt;br /&gt;
Location: http://www.example.org/index.php&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
該位置的URL被客戶端重定向到&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.org/index.php&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== 相對URL（Relative URL）示例 ===&lt;br /&gt;
相對URL是不包含方案或主機的URL。為了理解，它們必須與原始請求的URL相結合。例如，客户端请求:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
GET /blog HTTP/1.1&lt;br /&gt;
Host: www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
服务器回应:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
HTTP/1.1 302 Found&lt;br /&gt;
Location: /articles/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
該位置的URL被客戶端擴展为&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.com/articles/&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== 参见 ==&lt;br /&gt;
* [[網域名稱轉址]]&lt;br /&gt;
* [[HTTP]]&lt;br /&gt;
&lt;br /&gt;
== 参考文献 ==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
[[Category:HTTP]]&lt;/div&gt;</summary>
		<author><name>imported&gt;S8321414</name></author>
	</entry>
</feed>