阿帕奇 - 如何禁用浏览器缓存,同时调试的htaccess缓存、浏览器、阿帕奇、htaccess

2023-09-02 00:29:32 作者:孤酒

我试图调试.htaccess文件。火狐保持高速缓存重定向,我不能让他们身边。通常我会按Ctrl + F5,而是因为它已经重定向我到另一个网页,刚刷新我被送到了,而不是URL我输入的页面。有没有办法强制URL的刷新?

I'm trying to debug an .htaccess file. FireFox keeps caching redirects and I can't get around them. Normally I would hit Ctrl + F5, but because it has already redirected me to another page, that just refreshes the page I was sent to and not the url I typed in. Is there a way to force a refresh of a url?

下面是一个例子:

重定向example.com/hi到example.com/hello~~V,测试在Firefox和它的工作原理 从的.htaccess删除此行 在FireFox中键入example.com/hi,它仍然重定向到example.com/hello~~V 在Chrome浏览器类型example.com/hi,它不会重定向

这就是为什么我认为这是一个浏览器缓存的问题,而不是服务器的缓存。

This is why I think it's a browser caching issue, not server caching.

编辑:这似乎是火狐特定的,快速的解决方案是使用Chrome浏览器代替。一个小时,试图调试时,这是太长了之后,缓存过期。

This seems to be FireFox specific, a quick solution is to use Chrome instead. The cache expired after an hour, which is way too long when trying to debug.

推荐答案

如果您使用的是重写规则,只是用用r的R = 301。对于其他的目的,你必须清除浏览器缓存,只要你改变一个重定向。 (如果你不知道如何清除浏览器缓存,使用Google的一个操作方法应提供一个快速,简单的答案 - 或者随意评论,我会帮你)

If you're using RewriteRule, just use R instead of R=301. For other purposes, you'll have to clear your browser cache whenever you change a redirect. (If you don't know how to clear your browser cache, googling for a how-to should provide a quick and easy answer - or feel free to comment and I'll help you out.)

简而言之,尽量避免301S尽可能直到你有你的重定向正常工作。如果无法避开他们,准备定期清除浏览器的缓存。

Simply put, try to avoid 301s wherever possible until you've got your redirects working normally. If you can't avoid them, get ready to clear your browser cache regularly.