Home / Clear a 301 redirect from Google Chrome

Clear a 301 redirect from Google Chrome

Google Chrome caches 301 redirects for a long time. When typing in a URL that you’ve previously visited that had a 301 redirect on it, it takes you to the redirected location without checking the server again. This could be argued as expected behavior, because it is a permanent redirection after all, but this post shows how you can remove a specific URL from the 301 cache in Chrome.

The reason for doing this

When doing development on a website you can often cock up configuration settings etc (especially with htaccess RewriteRules) which might cause a 301 redirect that you don’t really want. This happened to me today and I ended up not being able to get back to the original URL because Chrome kept showing me the redirected location.

I didn’t want to clear my entire browsing history, so tried to remove individual URLs from the browser history, and also clearing the browser’s history for the last hour, but neither of those worked, and nor did restarting the browser.

Update November 19th 2015

The original advice below no longer works, and it appears the only way to do this is to now delete some of your browsing history. Follow the redirect, so it’s now the most recent thing in your browsing history then go to Chrome’s history, "Show Advanced Settings", "Clear Browsing Data", set the data obliteration drop down to "the past hour", have "cached images and files" checked and then click "Clear Browsing Data". I think that the images & files one is the only one you need to clear and then it should stop redirecting, assuming you changed the redirection.

Remove a single 301 redirect in Google Chrome

The redirect cock-up in the configuration was making requests from the homepage at e.g. http://example.com/ go to http://example.com/?q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/&q=/

After fixing your configuration (if you’ve had a similar issue to mine), view the source of the page you actually want with this url (again using the example.com homepage as the example):

view-source:example.com/

Don’t hit enter after typing in the URL. Use Cmd+R on a Mac or Ctrl+F5 on Windows (F5 on its own may also work on Windows, and possibly Ctrl+R – I don’t normally use Windows to know).

This will load the source of the page into the browser and clear out that 301, so when you view it normally with the view-source part it should all work OK without the redirect. It might take a couple of goes (it did for me when I tried to replicate the error when writing this post).