Loading AI tools
HTTP回應狀態碼 来自维基百科,自由的百科全书
307 Temporary Redirect是HTTP协议中的一个状态码(Status Code)。可以理解为一个临时的重定向[1]。
虽然RFC 1945和RFC 2068规范不允许客户端在重定向时改变请求的方法,但是很多现存的浏览器在收到302响应时,直接使用GET方式访问在Location头部中规定的URI,而无视原先请求的方法。[3]
因此,状态码307被添加了进来,用以明确服务器期待客户端进行何种反应。[4]
根据RFC 2616定义:
GET /index.php HTTP/1.1
Host: www.example.org
服务器回应:
HTTP/1.1 307 Temporary Redirect
Location: https://www.example.org/
这是一个例子,展示如何使用Nginx返回307重定向:
location /old/url/ { return 307 /new/url; }
这是使用PHP实现307重定向的方式:
<?php
header("HTTP/1.1 307 Temporary Redirect");
header("Location: http://example.com/newpage.html");
exit();
?>
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.