强制浏览器忘记缓存的重定向? [英] Force browsers to forget cached redirects?

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

问题描述

我继承了一个域,该域以前具有从根( /)到 /index.shtml的301重定向。



我删除了重定向,域中的其他站点,但是过去访问过该站点的用户将在浏览器中缓存重定向行为……这是一个非常长的时间,除非他们手动清除其缓存。



在这些浏览器中尝试访问example.com的任何人,甚至在发出任何HTTP请求之前,都会发送到example.com/index.shtml。现在这是一个巨大的问题,因为没有index.shtml,但是我可以使用标题做些什么来告诉浏览器忘记您刚才所做的重定向!?



http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2



在Stackoverflow上类似的问与答:
Apache-如何在调试htaccess时禁用浏览器缓存
无法删除301重定向



尝试避免301重定向,而改用302(临时)。这是一篇文章,介绍如何为301重定向设置无缓存(请尝试一下):
http://mark.koli.ch/set-cache-control-and-expires-headers-on-a-redirect-with-mod -rewrite



在此情况下可以执行的操作:您可以将标头重定向添加到文件index.shtml中,从而将用户发送到原始文件,他通常应该去的地方。


I inherited a domain that previously had a 301 redirect from the root ("/") to "/index.shtml"

I've removed the redirect and a different site on the domain, but people who visited the site in the past will have the redirect behavior cached in their browsers... for a terribly long time, unless they manually clear their caches.

Anyone trying to go to example.com in these browsers will be sent to example.com/index.shtml before they even make any HTTP requests. Right now this is a huge problem because there is no index.shtml, but is there something I can do with headers to tell browsers to "forget about that redirect you just did!"?

解决方案

The short answer: There is no way to tell the browsers of the users to "forget" the R 301 redirect. 301 means permanent, it can be only undone on action of the user or when the cache expires.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2

Similar Q and A on Stackoverflow: Apache - how to disable browser caching while debugging htaccess, Cannot remove 301 redirect

Try to avoid 301 redirects and use 302 (temporarily) instead. Here is an article how to set no cache for 301 redirects (didn't try it): http://mark.koli.ch/set-cache-control-and-expires-headers-on-a-redirect-with-mod-rewrite

What you could do in your scenario: You could add a header redirect to the file index.shtml, which sends the user to the original file, where he should usually go.

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

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