static images aren't caching with php-generated page

Posted by scootklein on Stack Overflow See other posts from Stack Overflow or by scootklein
Published on 2010-06-14T20:02:02Z Indexed on 2010/06/14 20:12 UTC
Read the original article Hit count: 208

Filed under:
|
|
|
|

Our website was just converted to being generated by mod_rewrite and php scripts. Images aren't caching in browsers when they seemingly should be.

All images follow format:

<img src="/images/header.png" />

I must avoid the script completely caching because the PHP parser needs to handle each page dynamically on each request; however, the download overhead of the large images is cumbersome on every single page load.

I would ideally provide headers for "Cache-Control: no-cache, must-revalidate" and "Expires: some_date_in_the_past" to force revalidation of the PHP script.

Why isn't the browser caching static images with consistent href values across all pages?

© Stack Overflow or respective owner

Related posts about php

Related posts about browser