http - 对动态短网址使用 301/303/307 重定向

标签 http redirect http-status-code-301 url-shortener http-status-code-307

我们正在实现一个短网址服务,其中重定向目标每天都在变化。这些 url 将由移动设备访问,并且始终是 GET 请求。我试图了解哪个是最适合这项工作的 300 型重定向。

据我所知,大多数 url 缩短服务使用 301 重定向(永久移动)。然而,根据规范,303(查看其他)和 307(暂时移动)重定向似乎是为我们的案例设计的...

  • 是否像 301 一样支持 303/307?规范说它们仅在 HTTP 1.1 中实现 - 这意味着什么限制?
  • 选择 301 与 303/307 是否有任何实际的缓存或性能影响。
  • 对于 GET 请求,是否有理由选择 303 和 307?
  • 是否有理由使用 302 重定向?
  • 还有其他需要考虑的事项吗?

最佳答案

Are 303/307 as well supported as 301? The specs say they were only implemented in HTTP 1.1- what limitations does that spell?

是/无。

Are there any actual caching or performance implications of choosing 301 vs 303/307.

我不这么认为。

For GET requests, is there any reason to pick 303 vs 307?

303 的语义不同于 307。如果请求的资源是“其他地方”,则 303 不是正确答案。

Is there any reason to use 302 redirects?

据我所知,不是真的。它具有与 307 相同的语义,但 UA 可能会将 POST 请求重写为 GET。

Any other things to consider?

参见 http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p2-semantics-18.html#status.3xx

关于http - 对动态短网址使用 301/303/307 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9012456/

相关文章:

php - php 中的 Curl-request > 带参数的 URL?

http - CORS cookie 未保存在浏览器中

php - 在 cakephp 2.4.6 中,只有两个页面将 HTTP 重定向到 HTTPS,最好的方法是 ht-access 或 Cakephp Security Companent

.htaccess - 在 Google Blogger/Blogspot 中使用 301 重定向

asp.net-mvc - ASP.NET MVC - 301 重定向 - SEO 问题

security - "x-requested-with"http header 可以被欺骗吗?

java - 用于在高负载(500kb 及以上)下对 Http 请求进行负载测试的工具

regex - .htaccess 如何仅将子域/文件夹重定向到子域

tomcat - 本地主机转发本地主机 :8080/blah in tomcat6

vbscript - 你能用 Microsoft.XMLHTTP 对象检测到 301 重定向吗?