Jump to content

turning last_modified headers back on


kevintynfron

Recommended Posts

I have a server that I'm trying to reduce the server load over xmas/new year by introducing far-future expires headers and removing Etags and last-modified headers.

 

The problem is that there's a subdirectory that I can't have the expires headers on because they are 'featured' images that change daily and I can't change the location because it's part of an automated system, etc.

 

Here's the code in httpd.conf:

 

#  Turn on caching for the main img directories
   <directory "/var/www/vhosts/example.co.uk/httpdocs/img">
        <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
            ExpiresActive on
            ExpiresDefault "access plus 1 year"
            Header set Cache-Control "max-age=31536000, public"
            Header unset Last-Modified
            Header unset ETag
        </FilesMatch>
   </directory>

#  Turn off caching for the featured directory as images always have the names featured01.jpg, etc.
   <directory "/var/www/vhosts/example.co.uk/httpdocs/img/featured">
      <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
        ExpiresActive off
        Header unset Cache-Control
      </FilesMatch>
   </directory>

 

So in pseudo-code, I want

 

<Parent directory>
    Far-future expires header 
    Long Cache-Control expires
    No Etag
    No Last-Modified
</Parent Directory>

<Specific subdirectory>
    No Far-future expires header
    No Long Cache-Control expires
    Etag
    Last-Modified
</Specific subdirectory>

 

Any ideas? I'm sure I could use "header set last-modified"  or something like that, but can't find the details I'm after.

Cheers

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.