Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a web application that is using redirects (for pretty URLs).

I am trying to debug logic in the way the redirects are working. However Google Chrome keeps remembering the redirects and even after I change the code, redirecting the same way.

This is making it very hard to troubleshoot.

For example if I redirect /this to /that, then change my code to NOT redirect /this anymore. Google Chrome is still redirecting to /that. Like the redirect is cached or something. Is there a way to turn this off?

share|improve this question
Does this still happen when you restart? It should stop after you restart with a fresh session – random Jun 30 '11 at 17:12
@random, restarting chrome does seem to fix it. However, I usually have a lot of windows open (ie: docs, db connections, tutorials, the page I am working on, etc.) If I am troubleshooting something it can take several tries before figuring out whats going on. I wouldn't really consider it ideal to have to keep closing all my windows. Thanks. – JD Isaacks Jun 30 '11 at 17:22
Workaround: Use 302 (temporary) redirects while testing, and switch to 301 (permanent) when you're done. (Caveat: Some browsers (Firefox) will cache even 302 redirects when they're going from http to https versions of the same page.) – TRiG Oct 7 '13 at 16:28
Entering a new www.mywebsite/?someparam=somevalue works for me – Mustafa Oct 23 '14 at 17:23

14 Answers 14

up vote 173 down vote accepted

Google Chrome will cache your 301 redirects. To get around this, and to keep the tabs open, you'll just need to clear your browser cache.

Chrome Menu Chrome Menu > Settings > Show advanced settings... > Privacy > Click Clear browsing data...

Whatever else you select, make sure "Cached images and files" is a checked option.

Then click Clear browsing data and you should be able to retest again.

If you've just followed the redirect, you only need to delete data from the past hour.

Alternatively, test and develop in incognito mode. There the cache is flushed after the browser is closed.

share|improve this answer
Thanks, I think I'll do it incognito. – JD Isaacks Jun 30 '11 at 17:53
If you use incognito mode, it is unnecessary to close the browser. Simply close all incognito tabs. – MετάEd Feb 3 '14 at 0:21
Latest version of chrome, this option would be "Cached images and files" instead of "Empty the cache" – Dan R Aug 7 '14 at 15:38
I keep getting redirected, even in incognito mode. – Gaia Sep 21 '14 at 16:49
@Gaia yea, that seems to be problem in Chrome incognito. If you are just testing, you might want to use Firefox for this. Firefox private browsing works fine :) – chhantyal Jan 26 '15 at 14:19

There's a "wontfix" Chromium bug about this,

That is the expected behavior.

Note that:

  1. You can add cache control headers to a 301 and we'll follow them (expiration etc)
  2. If the resource in question is a subresource, reloading the page will cause the redirect to be re-validated with the server.
  3. You don't have to lose your entire cache. Just follow the redirect and delete the last hour.
share|improve this answer
+1 for point three. – Neuralrank Apr 14 '13 at 21:46
What does "delete the last hour." means? How to do it? – Mikaël Mayer Jun 10 '15 at 21:03
@MikaëlMayer When you click "History > Clear browsing data", you can select a timeframe to remove data ("the past hour", "past week" etc) – dbr Jun 26 '15 at 13:16

It's not a perfect solution, but I was able to prevent Chrome from using the cached redirect by passing a bogus query string, or adding a bogus parameter to the existing query string. For example, adding a simple ? to the end of a URL that didn't have q query string worked for me on Chrome 30 on Max OS X.

share|improve this answer
Yep, this works. becomes I'ts the easiest of the bunch – Jan 24 '14 at 22:40
This is an awesome trick. I assume you can use this indefinitely ?abc, ?abc2 etc... – brentonstrine May 12 '14 at 20:36
1 this is the best answer! thanks! has been driving me crazy for almost a year! – tim peterson Nov 26 '14 at 15:06
Fastest solution by a long shot - I hate caches sometimes! – Novocaine Nov 25 '15 at 10:53

If you have the "Disable cache (while DevTools is open)" option enabled in the DevTools, then simply having the DevTools open is enough to bypass the redirect cache, without constantly throwing away your session.

share|improve this answer
note: if devTools is open, there is a fast way to delete cache: click on refresh button with right click and choose full reload ;) – user65130 Nov 21 '14 at 17:08
this does not work all the time. I deleted all my cache and still redirecting. Only with incognito mode it works and you get consistent behaviour – Claudiu Creanga Sep 10 '15 at 13:47
This is my preferred solution! – GiDo Jan 9 at 16:05
Why is this not the top solution? the others are awful by comparison! – Brian Jan 31 at 1:26
best solution, vote it up people! – Timo Huovinen Apr 19 at 17:29

This is the sure proof way to clear Chrome's sticky memory for redirects:

  1. Open the Developer Tools panel (optioncommandi on Mac OS X, or ctrlshifti on Microsoft Windows)

  2. Click and hold the reload icon enter image description here

  3. A menu will open enter image description here

  4. Choose the 3rd option from this menu ("Empty Cache and Hard Reload")

share|improve this answer
As an aside: this is not available on a Mac. – Arjan Aug 4 '15 at 10:15
this does not always delete cached redirects – Claudiu Creanga Sep 10 '15 at 13:48
It is available on Mac, but the menu is only available if you have the dev tools open. I assume this might be the same on Windows. – Percy Oct 28 '15 at 13:48
@Arjan it is available on a Mac see… – Gaia Oct 28 '15 at 19:24
Seriously this is by far the best answer and should be accepted as such! – Shane on a bike Apr 14 at 1:10

Chrome caches HTTP redirects and stop checking with the site if the redirect has changed. This can be frustating, since the easiest way to fix (visiting the site and forcing a hard refresh) can't be used because the redirect will happen before you access the link. This is a won't fix issue.

To workaround this, you can clear your browsing data, as explained here or you can follow the steps below and avoid losing your history.

  1. Open the Chrome Developer Tools dev-tools

  2. Click in Settings settings

  3. Check Disable cache (while DevTools is open) disable

  4. Visit the site that you wanted and the cache problem will be solved.

share|improve this answer
You'll find the option "disable cache" on the network tab too, it is the same option. For debugging redirects I would suggest using the "preserve log", too. – Trendfischer Oct 6 '15 at 12:07

To clear the redirect cache for a single page in Chrome, View Source and do a hard refresh (CTRL + SHIFT + R).

This works as the source browser doesn't automatically follow the 301 redirects.

share|improve this answer
Didn't work for me in Chrome 25 – swrobel Mar 20 '13 at 23:52
This doesn't work if the redirect is for all pages. I have a www. -> no www. redirect - so the redirect is on the first hit, so I can't refresh anything. Each time I try to go to the page to refresh it follows the 301 - then it's too late! – Ian Grainger Mar 25 '13 at 11:12
@Ian What if you type in the address bar ? Does that let you refresh without it being redirected? – Matthew Blackford Mar 26 '13 at 0:13
@MatthewBlackford AFAICT the same thing, I actually get the source of the redirected page. Not sure my test was that great, though TBH. I've deleted browsing history to 'fix' this problem. – Ian Grainger Mar 26 '13 at 14:07
This only works for javascript and metatag redirects. HTTP redirects are still followed – Nov 26 '14 at 15:46

If you just want to check the redirects are working as expected it's probably easier to use a command line tool like wget or similar. You can inspect the response headers and redirects are not cached.

share|improve this answer

In either Chrome or Firefox, you can refresh the redirect by typing "" and hitting enter. Then, refresh that page. Now, that should force Chrome or Firefox to refresh the redirect.

share|improve this answer

As described here could be caused by HSTS

To get around this, I did the following.

In the Chrome address bar type "chrome://net-internals/#hsts" At the very bottom of a page is QUERY domain textbox - verify that your site (localhost e.g.) is known to the browser If it is, DELETE the localhost domain using the textbox above Your site should now work using plain old HTTP

share|improve this answer
Hey, thanks. This really helps with sudden https redirects cache. – Ruberoid Jan 3 at 17:46

For develop purpose i recommend you in Chrome open DevTools settings and check "Disable cache". Then 30x redirects are not cached and you can debug .htaccess files and so on! enter image description here

share|improve this answer

simplest method, hard refresh. hold Ctrl + R a few seconds. This clears redirects as well as static resources.

share|improve this answer
Why would you hold it instead of simply pressing Ctrl+R? – gronostaj Oct 1 '15 at 18:29
@gronostaj Wasn't my answer plain and simple ?? . Without holding, it would be just a normal refresh. Which does not clear cached resources or redirects. – Ryu_hayabusa Oct 7 '15 at 13:02
Holding is just like pressing it multiple times. Open Notepad and hold R, multiple Rs will appear. This is exactly the same, but with Ctrl. Holding Ctrl+R is an exact equivalent of pressing it dozen times per second for a few seconds. That's not smart, it's abusing built-in refresh mechanism and relying on undocumented behavior. – gronostaj Oct 7 '15 at 14:06
@gronostaj Yes it is an undocumented behavior. The accepted answer does not works for me. That's why i shared it here. I don't see any other way to clear cached redirect . If you know any other methods , feel free to share. – Ryu_hayabusa Oct 10 '15 at 18:44
  1. Go to chrome://settings/search#clear%20browsing%20data

  2. Click "Clear browsing data"

  3. Check "Cached images and files" (and uncheck the rest if you want)

  4. Click "Clear browsing data"

enter image description here

share|improve this answer

Go to chrome://net-internals and at the far right open the drop-down and choose "Clear Cache". As of version 48, this was the only thing that worked for me to clear a cached 301 (permanent redirect).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .