Clear 301-redirect cache in Firefox

217

30

Is it possible to clear only 301-redirects from Firefox's cache? CTRL+F5 doesn't do the job since you just reload the target without caching but do not clear the cached redirect.

An option to disable caching of those redirects completely would be fine, too - but some way (possibly through an extension) to remove those cached redirects would be better.

Note: I'm not looking for answers that disable all caching (including CSS, JS, etc.)

ThiefMaster

Posted 2012-08-29T21:44:20.047

Reputation: 4 918

More answers here: http://stackoverflow.com/q/6980192

– tanius – 2015-10-09T21:05:22.460

1FYI - 302 gets cached as well – dsmtoday – 2016-01-16T01:36:12.590

1"This response is only cacheable if indicated by a Cache-Control or Expires header field." - so unlike 301 it shouldn't be cached all the time – ThiefMaster – 2016-01-16T01:42:46.263

This always works for me, as long as you know the exact URL that you need to drop (read the comment too!) – Janaka Bandara – 2018-04-17T14:26:33.610

Use 302 or 307 if you want to redirect temporarily... 301 is for permanent redirection... – inf3rno – 2013-12-07T08:56:42.547

2I know that. But sometimes you forget to change that or your framework uses one (for example, Flask does so when redirecting from /foo to /foo/) – ThiefMaster – 2013-12-07T12:02:53.760

1Hmm most of the frameworks turn off cache by debug mode, or you can turn it off manually if you add no-cache, no-store headers. That will prevent cache by 301 headers too, if I am right. If it was cached recently, you can clear the recent cache by history/clear recent history. If it was not recent, you can find the site in the history, click on it with the right button and choose delete this page or forget about this site. Theoretically all of these are working, in practice I never used them to remove a redirection from the cache... – inf3rno – 2013-12-07T18:17:58.377

Answers

272

Locate the site you are redirected from in the History sidebar. Right-click it and select "Forget about this site".

No addons required!

P.S. I'm pretty sure this didn't work in the past, but nowadays following the redirect and then clearing the cache for past hour will actually remove the cached redirect.

RomanSt

Posted 2012-08-29T21:44:20.047

Reputation: 7 830

18Works for me too. Make sure you delete the history entry of the site you're being redirected from, not the site you're redirected to. – marcvangend – 2014-10-07T09:22:15.823

Works for Desktop, would like to do the same for Android. – DmitrySandalov – 2015-01-27T13:24:40.107

Worked for me without needing to delete the history of the entire sire being redirected from. – user347375 – 2015-03-28T13:58:40.867

Doesn't work on latest Firefox (version 40) – Breno Leitão – 2015-09-08T17:17:31.347

19Confirmed on Firefox 41. But note: "Forget about this site" will forget the cached pages, URL history (needed for auto-completion) and even saved passwords for the whole domain. It says "site", not "page", and this feature seems intended to protect your surf history privacy. It might not be what you want here, so be careful. – tanius – 2015-10-09T21:01:32.410

1working perfectly – h3nr1ke – 2015-10-12T13:30:50.660

2Works in Firefox 50. The end of many hours of frustration. – Andy Gee – 2016-11-29T07:21:10.890

I have disabled history in Firefox. So the history list is empty and I can't clear it. :( – checksum – 2017-01-01T12:01:59.880

click on the right side (hamburger ) menu, then history, clear recent history, select Today and check only the Cache. Click Clear now button. That worked for me. Firefox V - 55.0.3 – mihkov – 2017-09-08T08:51:34.417

1BEWARE! Based on my experience with FF so far (from version 40-something up to the nightly build from Apr. 13), this clears ALL entries (for ALL domains) in the browser cache (except for a very few particular websites, whose behaviour I have yet to investigate), not just the site that you are trying to forget! – Janaka Bandara – 2018-04-17T14:23:43.133

Thank you very much! That just worked. (I had accidentally set a 301 redirect for the wildcard subdomain to www.…, which broke all subdomains managed at the secondary DNS … ) – user45469 – 2018-07-22T13:06:00.013

This will also clear cookies, as well as other things. – Flimm – 2018-11-12T12:44:33.130

This did not work for me. – Flimm – 2019-08-16T11:12:25.757

Didn't work for me, too. – Frozen Flame – 2014-05-17T04:20:35.693

25

Here is the simple solution for this in Firefox:

Hamburger menu -> Preferences -> Privacy & Security -> Clear Data (under Cookies and Site Data)

Make sure "Cached Web Content" is checked. You probably want to uncheck "Cookies and Site Data". And then click "Clear", and it's done.

enter image description here

user1983017

Posted 2012-08-29T21:44:20.047

Reputation: 369

4Nice! Unlike my solution, this works even if your only visit to the site is a redirect to an error page, because those don't appear in the history and you have nothing to click "Forget about this site" on. – RomanSt – 2014-08-14T16:31:45.833

3the only problem with this solution is that it doesn't clear only 301-redirect as the OP would like. – Loopo – 2014-12-23T15:00:46.423

23

The quickest way to remove the cache in Firefox, which includes 301 redirects, is the following:

  • Press CTRL + SHIFT + Delete
  • Change the time range, if needed
  • Click on Details and uncheck everything other than "cache"

Corneliu

Posted 2012-08-29T21:44:20.047

Reputation: 339

This actually works fine, no need to downvote. – Simon A. Eugster – 2016-07-19T06:51:53.580

2This is somehow overkill since it deletes at least the last our of activity, but may be useful. – Stéphane Gourichon – 2016-09-30T10:24:58.683

Better to loose the last hour than the whole history, saved passwords etc... Thanks – dario – 2017-12-13T18:02:56.477

1Not working in Firefox 66 – Morteza Ziyae – 2019-05-23T05:18:05.910

21

The only solution I've found so far - short of clearing the whole cache - is the "Disable entire cache" toggle in Web Developer Toolbar. Once disabled you hard reload the page and you get the new version (remember to uncheck the toggle after you're done).

Matteo Riva

Posted 2012-08-29T21:44:20.047

Reputation: 8 341

Additionally to "Disable entire cache" I had to select "Check For Newer Version Of Page Every Time" for the redirect cache to be forgotten. This is the only solution that worked for me on Firefox 35.0.1. – None – 2015-02-04T11:50:36.790

this was the only thing that worked for me FF 59.0 - resending the request did not clear it & clearing more caches was not an option – RozzA – 2017-03-12T23:57:47.913

2Somewhat obvious, but this checkbox is in the 'network' tab in the developer toolbar. It's now just called 'disable cache'. I like this because it doesn't wipe all info about the site from the cache. – Jahmic – 2018-04-25T08:03:20.813

I see a "Disable DNS cache" option, and that seems to do what I want. Very annoying this caching! Thanks for the tip. – SPRBRN – 2013-04-24T13:58:02.737

13

Another solution is;

  • Open the Developer toolbar on the Network tab (Ctrl+Shift+Q or Cmd+Opt+Q)
  • Ensure the "All" or "HTML" filter is enabled on the bottom row
  • Navigate to the URL you're receiving a cached redirect on, as usual
  • Notice the first HTML request will show a 301 in the Network list
  • Right-click that row, choose "Edit and Resend"
  • A pane will display on the right, allowing you to edit the HTTP request. Just click "Send"
  • A new HTML request will show in the Network list, this time (hopefully!) returning a 200
  • Navigate to the URL again, it should work as expected

NoChecksum

Posted 2012-08-29T21:44:20.047

Reputation: 272

Thanks, this is a good scalpel-y way that works for pages that return an error (and thus don't show in history). – cincodenada – 2016-04-08T00:46:26.377

3This answer looks complicated, but to me it is the only one that actually answer the OP's question: remove only the 301-redirect cache. – Stéphane Gourichon – 2016-09-30T10:28:26.477

3

This does not work with FF 59.0.1, or at least with some requests. Clicking "Send" does nothing. Not sure whether https://bugzilla.mozilla.org/show_bug.cgi?id=1151932 is related, but it discusses similar symptoms.

– Richlv – 2018-05-02T19:04:26.190

This is actually the only one that worked for me though the second to last option seems to hang on luck. I spent several hours on this annoying issue getting redirect loops in outlook. Thank you! – Ken4scholars – 2019-08-03T13:40:22.510

Doesn't work in FF 73.0 (Linux). The resent request returns 200, however browsing to the URL still redirects :( – Beli – 2020-02-17T13:50:10.007

4

Late answer. With Firefox 50.

  1. Open up Web Developer in Firefox (F12)
  2. Open up Toolbox Options (Gear/Cog shape icon on top of Web Developer window)
  3. Under Advanced Settings, check the box Disable HTTP Cache (when toolbox is open).

With Web Developer windows opened, redirect cache will be refreshed.

checksum

Posted 2012-08-29T21:44:20.047

Reputation: 1 304

1I'm quite sure this disables the whole cache altogether, making reloads of a large application with lots of JS/CSS files - even when running locally - awfully slow. – ThiefMaster – 2017-01-01T12:00:56.097

It's a solution to clear your redirect cache frustration ( almost no way good way to clear it, i disabled history on my browser, other answers above don't solve my problem :( ). Then either close the Web Developer (F12) or uncheck the options then you can continue on development. :) – checksum – 2017-01-01T12:06:15.557

When the checkbox is checked, it doesn't redirect, as expected. However, as soon as I uncheck the checkbox, the redirect returns. It looks like this does not clear the cache. – Flimm – 2019-08-16T11:15:24.960

2

If you are on windows, and the url is not shown in the browser history

Use a search tool like wingrep or the option "Find in files..." in Notepad++ to search for files under this path:

C:\Users\<user>\AppData\Local\Mozilla\Firefox\...

Search for files that contains both the exact text: Moved Permanently, and the URL that are redirecting.

The search might take a minute, and might return more than one file.

Then simply delete the file(s) found, and restart Firefox.

User0

Posted 2012-08-29T21:44:20.047

Reputation: 1 058

Which is even more of a hassle than just clearing the cache considering your solutions needs a browser restart... – ThiefMaster – 2016-10-03T07:28:28.347

2Your question was: "Is it possible to clear only 301-redirects from Firefox's cache?" ... – User0 – 2016-10-03T17:42:02.853

2

You can clear cached redirects as a part of browsing history, selecting a time range. For the recent Firefox Quantum 57.0.3, here's how to do it:

  1. Click the hamburger menu or the library button next to the search bar.
  2. Click 'History'.
  3. Click 'Clear Recent History...'.
  4. Expand 'Details' clicking a small button next to the label.
  5. Uncheck all but 'Cache'. Optionally: select the preferred 'Time range to clear'.
  6. Click 'Clear Now'.

For earlier versions of Firefox, see @mihkov's comment on the question.

Dmytro

Posted 2012-08-29T21:44:20.047

Reputation: 121

Welcome to [su]! It's good to link to the comment you used for reference, but it's even better to add the context in the answer itself, to make the answer self-contained. That way, someone looking at your answer does not have to read the comment thread first. – jpaugh – 2018-01-11T19:53:02.643