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
https://forums.phpfreaks.com/topic/137259-turning-last_modified-headers-back-on/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.