2

I have no idea what am I doing wrong. While I appreciate the idea of caching and how much it speeds up the loading, apparently I just can't set my server right when it comes to this functionality.

So, I'm making a pretty dynamic website (blog, kinda) that updates every hour. I thought, hey, maybe I should set the caching of text/php and text/html content for 1 hour?

And I did just that (I think so?):

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 month"
    ExpiresByType text/html "access plus 1 hour"
    ExpiresByType text/php "access plus 1 hour"
    Header set Cache-Control "public"
</IfModule>

However... It doesn't work. The contents still won't refresh for client even after 1 hour after accessing it. Tested it in few browsers among few different PC's. Nada, it won't update after one hour, unless I force it.

Did I misunderstood how expires work by any chance?

hjpotter92
  • 71,576
  • 32
  • 131
  • 164
wolterkam
  • 21
  • 1
  • Is the module loaded? What do you see in the response headers? – hjpotter92 Oct 09 '15 at 14:54
  • 1
    View your response headers and post them on the question please. There are numerous [methods to see response headers](http://stackoverflow.com/questions/809302/tool-to-view-response-headers) dependent on your web client – Steve E. Oct 09 '15 at 15:02
  • I'm pretty sure the module loads just fine, the images etc. are cached just fine. I've added manually in PHP the headers for PHP files that I don't want cached and the problem is gone, however I'm still not sure what was/is wrong with htaccess files. These are the headers without no-cache in PHP: Last-Modified: Sat, 10 Oct 2015 16:00:02 GMT Cache-Control: max-age=2592000 Expires: Mon, 09 Nov 2015 16:53:12 GMT – wolterkam Oct 10 '15 at 16:51

0 Answers0