如何避免浏览器重定向缓存 [英] How to avoid browser redirect caching

查看:5121
本文介绍了如何避免浏览器重定向缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是拳头时间,我坚持这个问题。
每次当我使用301重定向,浏览器缓存它。当我在我的应用程序改变的重定向,我manualy必须清除浏览器我的缓存。

It's not the fist time that i stuck to this problem. Everytime when i use an 301 redirect, the browser caches it. When i change the redirect in my app, i manualy have to clear my browsers cache.

这是不是一个网站,你就会明白非常欢迎。
是否有解决方案,以避免这种缓存?

This is not very welcome for an website as you will understand. Is there an solution to avoid this caching?

目前我得到新的重定向从列表我的客户。在我的.htaccess,我取代了旧的新的,但它不土气的效果。

Currently i got an list of new redirects from my customer. In my .htaccess, i replaced the old ones for the new ones, but it doesn't toke effect.

当我清理我的浏览器缓存,它似乎工作propper。

When i cleared my browser cache, it seems to work propper.

任何解决方案?非常感谢!

Any solutions? Thanks a lot!

推荐答案

要引用在301状态code 的HTTP规范:

To quote the HTTP specification on the 301 status code:

301永久移动

请求的资源已被分配一个新的永久性URI和任何
  这些资源未来的参考文献应使用返回之一
  的URI。与链接编辑功能的客户端应该自动
  到请求URI重新链接引用的一个或多个新的
  引用由服务器,在可能的情况返回。这种反应是
  可缓存,除非另有说明。

The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.

因此​​,事实上,浏览器缓存重定向URI不应该是一个惊喜,因为它按规定完成了。

Hence, the fact that browsers cache the redirected URI shouldn't be a surprise, since it's done as specified.

要解决这个问题,大多数网站都使用302(307也可以使用)。

To get around this problem, most sites use 302 (307 could also be used).

这篇关于如何避免浏览器重定向缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆