How clear Apache cache?

I’m getting a weird situation where even though I updated an image in a folder for a website in apache, it’s still showing the old image. And yes, I checked it in multiple browsers and on diff. computers. (Apache is in a virtualbox OS) Here’s what I’ve done:

  1. Checked it in firefox on the host, cleared cache, reloaded
  2. Restarted apache
  3. Checked it in konqueror for first time, still showing old version
  4. Checked it in the actual file folder and it’s correct there
  5. Checked it for first time on virtual machine’s OS in its firefox, and it shows the wrong/old image

Any ideas?

Apache has no cache, it’s normally your web browser or any proxies in between. Often a new file is not served because the modification date is older than the file it replaced.

No, that’s impossible here because when I loaded it into konqueror for the first time ever (I’d never visited the site or viewed the image in konqueror before) it showed the old image! So the old image was still being served up by apache.

And apache does have some sort of cache: Caching Guide - Apache HTTP Server

That’s only if you have set it up. Out of the box Apache does not have a cache. You can look at the logs in /var/log/apache2 to see if the request was served by a 200 reply or a 304 not modified reply. It could also be a simple typo, you put the new file in the wrong directory or under a different name.

Well then what’s causing the image not to refresh/change? I tried everything: cleared the whole cache in firefox. Tried viewing the image directly in the browser (not in a web page but straight to the image url) and refreshing. Nothing changes it!

The only way I’ve been able to get it to change the image is to change the name of the image, reload the web page and then change the name back and reload again and then I get the image.

Is there a proxy between you and the web server? Even one you might not know about, like an ISP’s “transparent” proxy.

Hash: SHA1

Where is the website? This could easily happen with a proxy server
somewhere on which you do not plan. For example, if your website is
outside your network any number of devices between your computer and the
web server could cache pictures for you. Similarly if your server is in
your network but your system or browser is configured to use a proxy
server then that proxy could be “helping” you or your organization. Using
a Firefox plugin like Live HTTP Headers (or getting a LAN trace if the
traffic is not encrypted) would probably show this fairly well.

Either way, ken’s right; Apache doesn’t cache by default.

Good luck.

On 09/01/2010 06:06 PM, 6tr6tr wrote:
> The only way I’ve been able to get it to change the image is to change
> the name of the image, reload the web page and then change the name back
> and reload again and then I get the image.
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


No, the website is hosted locally in an Ubuntu LAMP setup inside VirtualBox. So I’ve viewed the site both on the host computer and inside the virtual machine and both show this issue.

Still getting this issue.

Dear 6tr6tr,
I know this thread is old but thought that a solution would be nice to have so here it is
I had the exact same problem and yes apache is cacheing the images !
I would delete the file from the vboxsf then clear the cache from the browser then check in the server directory that the file was not there
then reload the page and it was still there. How i know it was in the server well i was able to download it from the browser to my desktop.
What was mind boggling was that updates to the php html or any other parsed file format worked just fine.
I looked further into the issus and found that apache has a glitch with network mounted folders of NTSF format. Something to the effect that non-parsed elements are sent to the browser and since the file format and permissions on the network drive were incapatible makes apache cache some how. So we want apache to stop processing these elements and force it to read them each time they are requested.
—>add this to the bottom of the file /etc/apache2/apache.conf

#Disable image serving for network mounted drive
EnableSendfile off

Hope that helps

Thank you very much! This solved my problem. We have roughly the same setup. I’ve been working on this for days. Thank you very very much! You’re saving me much time!

My setup is Windows XP, with CentOS running on a VirtualBox. The PHP files I’m working on is on Windows XP but they’re served by CentOS, because I need the APE (Ajax Push Engine) and it doesn’t work on Windows. Basically, the files being hosted by httpd is on a Windows NT File System. After removing the comment on EnableSendfile off on my httpd.conf file, it started de-caching things.

Once again, thank you.

Cool thanks!

I have it too. All this talk about “it must be on your ISP” is nonsense. Like you, it is a local copy on my laptop, I have even pulled out the cable to the router, so the old images are stored on my laptop somewhere. I changed the directory name (and in the PHP code too) and it loads the correct images, but as soon as I change the directory back to the correct name (and the code) it finds the old images again! (No cache eh? well explain where they ARE held).

In my case, I do have network drives not involved in this instance. Apache and the site are on my local C: drive. I tried your fix jusr in case but it didn’t help.
My files are slightly different, I have two config files, but I changed both

Please gentleman This thread is almost 6 years old!

Not very many people will still follow new posts here. Also I assume that all software involved in the mean time changed to newer versions.

So please, when you have a problem, start a new thread in the most appropriate forum with a good telling title. That is realy the best way to draw the attention of the people here, including those that might be able to help you.

This thread is CLOSED.