Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

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 have been asked to work on a corporate website a previous employee had created. The site is on shared GoDaddy hosting. One of the first things I noticed (after the 140KB JPEG on the front page, which is now 22KB for no noticeable degradation) was that none of the HTML pages being served were getting cached. Turns out every PHP file on this website is sending the following headers:

Pragma: no-cache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

The 1981 expiry date is notable as it is an odd day/time to choose arbitrarily. This is not affecting other MIME types, just text/html (all of which are PHP-generated). As the server is running PHP 5.2 there's no header_remove() function. I have tried overriding them in PHP by using empty values:

header("Pragma: ");
header("Expires: ");
header("Cache-Control: ");

This didn't work. So I tried removing them via .htaccess:

<FilesMatch "\.php$">
  Header unset Pragma
  Header unset Expires
  Header unset Cache-Control

This also failed. I am beginning to suspect a GoDaddy shared hosting misconfiguration that I won't be able to fix :-/

Has anyone seen this before or got other ideas I can try?

share|improve this question
up vote 1 down vote accepted

You're correct the date is there to prevent caching. The specific date is just a silly bit of trivia, though.

You seem to be right about GoDaddy not allowing or ignoring some of these options, though apparently it can be managed via one of way-too-many methods of attacking it; seems weirdly conditional, though. Here's a KB article on enabling mod_expires, which is apparently off by default. Given it's official documentation, that's probably your best bet.

This blog post (from 2010) has a few other takes on this you might try if that still doesn't work.

share|improve this answer
The 'trivia' you linked to contained this gem: "The date is the birthday of the developer Sascha Schumann who added the code. From session.c: ..." -- So, it's added by PHP's session code. Brilliant. There's no need for sessions on these public facing pages. I have located and deleted the offending start_session() line, and now all my HTML pages get cached. – Nicholas Aug 31 '12 at 9:38

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.