Bluemagica
Bluemagica

Reputation: 5158

Weird caching issue

I don't know if this is the right place for this, if not, please suggest where to post it.

I have a standard apache/unix server running cPanel 11, where I put all my php based sites. But whenever I make any changes to the files here, the changes don't seem to reflect in the browser immediately. The pages seem to fetch cached or old copies, till I hit Ctrl+f5(force refresh) on my browser. I tried creating an htaccess to disable any potential caching with:

<FilesMatch "\.(html|htm|js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</FilesMatch>

but the problem still persists. Can anyone please suggest how to debug or solve this situation?

PS: I have tried contacting the hosting provider but they couldn't find anything wrong with server settings(or at least that's what they claimed).

EDIT: Response Headers:

Response Headersview source
Cache-Control   public, max-age=10800
Connection  Keep-Alive
Date    Wed, 25 Sep 2013 16:00:59 GMT
Expires Wed, 25 Sep 2013 19:00:59 GMT
Keep-Alive  timeout=5, max=100
Server  Apache
Request Headersview source
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Cache-Control   max-age=0
Connection  keep-alive
Cookie  PHPSESSID=bccf480bccca9912b4a4bb0225ec638c
Host    ___________________________
If-Modified-Since   Wed, 25 Sep 2013 15:39:20 GMT
Referer __________________________
User-Agent  Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0
Response Headers From Cache
Cache-Control   public, max-age=10800
Content-Length  22046
Content-Type    text/html
Date    Wed, 25 Sep 2013 16:00:59 GMT
Expires Wed, 25 Sep 2013 19:00:59 GMT
Last-Modified   Wed, 25 Sep 2013 15:39:20 GMT
Server  Apache

Upvotes: 0

Views: 178

Answers (1)

exussum
exussum

Reputation: 18576

<FilesMatch "\.(html|htm|js|css)$">

is your problem

you said your working with php files ? Add them to the list

<FilesMatch "\.(html|htm|js|css|php)$">

Upvotes: 1

Related Questions