Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 recently set up an Ubuntu 12.04 server with the default LAMP task. Also added virtualmin.

All requests to apache return this in the headers.

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0

How/where do i set cache-control to something more sensible to allow browsers to cache content?

Tried putting this in the .htaccess to no avail. mod_expires is enabled. The result is double Cache-Control headers!

<IfModule mod_headers.c>
  Header add "Cache-Control" "max-age=3600"
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 3600 seconds"
share|improve this question

Apparently it was related to me starting a php session.

Setting session_cache_limiter('public') solved it. You can add it in php.ini or in your script.

share|improve this answer

Looks like your site generating these headers. Check it's code.

share|improve this answer
Just searched the entire site in Coda for the word "cache", it's not there and i wrote it all myself using no external libraries. Any other clues please? – Maciej Swic Dec 25 '12 at 15:12
Grep for word "Header" or "header" – dr-evil Dec 25 '12 at 15:27
Just header('Location... – Maciej Swic Dec 25 '12 at 15:29
Ok. You have to grep all site code (including .htaccess'es) and apache configs. – dr-evil Dec 25 '12 at 15:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.