Mobile app version of vmapp.org
Login or Join
Annie201

: Difficulty enabling caching on inherited site 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

@Annie201

Posted in: #Apache #Cache #Http #Php

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
</FilesMatch>


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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Annie201

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cody1181609

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme