Chrome Caches Redirects
Google Chrome caching redirects, is a known behavior and not one that is planned to change. This is a logical decision, unfortunately the lack of any obvious mechanism to clear these redirects is frustrating at times. There are generally two situations where this occurs.
When the Website Returns a HTTP Status Code Redirect
When a server sends a webpage it includes headers. These headers can include an instruction to redirect the visitor to another page. A common redirect header is the 301 redirect http status code. Once Chrome caches this response, it will automatically redirect to the new location without checking with the server. The problem is that even if the server stops sending the 301 redirect, Chrome will continue redirecting to the new url.
When the Content Contains a Meta Refresh Redirect
In this case, the server responds with a 200 status code indicating that the page loaded just fine. However, in the content of the page is included a redirect meta tag like
<META HTTP-EQUIV="refresh" CONTENT="0;URL=/cgi-sys/defaultwebpage.cgi">
Personally, I’ve found this often arises when creating a new site using cPanel. If you visit the new site before adding an index page, you are redirected to
/cgi-sys/defaultwebpage.cgi. After you add an index page, you’ll find you are still redirected to
/cgi-sys/defaultwebpage.cgi and this redirect is surprisingly difficult to clear.
How to Clear a Redirect from Google Chrome’s Cache
The secret is to use the Chrome Developer Tools, which are built-in to Chrome.
1. Open the Chrome Developer Tools
You can open the Chrome Developer Tools in both Windows and OS X by doing the following:
- Select the Chrome Menu Button at the top-right of your browser window
- Click More tools in the nav
- Click Developer tools in the sub-nav that opens
2. Open the Chrome Developer Tools Settings
Open the Customize and control DevTools menu by clicking the three vertical dots (in the picture, this icon is highlighted by the red rectangle for emphasis).
Then choose Settings from the nav.
3. Disable cache
Under the Network heading, click the checkbox for Disable cache (while DevTools is open).
Do NOT close the Developer Tools Window.
4. Visit the problem url
In the URL bar, type the url that was being redirected. At this time you should not be redirected.
Initially, http://example.com/ redirects to http://example.com/cgi-sys/defaultwebpage.cgi
but you then remove the redirect and add content at http://example.com/. Unfortunately, every time you visit http://example.com/ you are still redirected. You can avoid this by using Incognito Mode but that is a short-term fix.
Clear the Redirect
- Open Chrome Developer Tools
- Open the Settings for Chrome Developer Tools
- Check Disable cache (while DevTools is open)
- Visit http://example.com/ and find yourself pleasantly surprised to not be redirected.
How do You Deal with Cached Redirects in Chrome?
I’d love to hear about other ways people are clearing these cached urls.