SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    Berlin
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP produced Images: no-cache

    I am using
    Code:
    ExpiresByType image/gif "access plus 30 days"
    to set the cache-control for images on my server.

    Now I have one image, that is produced by php. This image should not be cached.
    But if I add a
    PHP Code:
    header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0,pre-check=0"); 
    the output will be
    Code:
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=2592000
    What could I to to keep the cache information for images in general, but not have the 30 days (max-age=2592000) added to this one particular image?

    Regards
    Fl÷zen

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Have you tried setting a max-age in your header to override the default?

  3. #3
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a <Files> that applies to the single file, and contains an ExpiresActive directive which turns off mod_expires for that particular file.

  4. #4
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    Berlin
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by joebert View Post
    Use a <Files> that applies to the single file, and contains an ExpiresActive directive which turns off mod_expires for that particular file.
    OK, thanks, that was a good idea

    So I can either turn it off for all PHP files:

    Code:
    <Files ~ "\.(php)$">
    ExpiresActive Off
    </Files>
    Or only define caching for PHP GIFS:
    Code:
    <Files ~ "\.(php)$">
    ExpiresByType image/gif "access plus 10 minutes"
    </Files>
    Fl÷zen


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •