Page 1 of 1

cache control to a specific file .

Posted: Fri Mar 20, 2009 8:34 am
by lovelf
Hello, I am trying to set an expiry time to one file but it gets the same expiry time that the rest of the files get.

Code: Select all

<FilesMatch "file.php">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>
<FilesMatch ".*">
  Header set Cache-Control "max-age=259200, must-revalidate"
</FilesMatch>
file.php gets 259200 instead of 7200, why is this?

Is the code above wrong?

Thanks.

Re: cache control to a specific file .

Posted: Fri Mar 20, 2009 11:10 am
by Christopher
Try:

Code: Select all

<FilesMatch ".*">
  Header set Cache-Control "max-age=259200, must-revalidate"
</FilesMatch>
<FilesMatch "file.php">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

Re: cache control to a specific file .

Posted: Fri Mar 20, 2009 6:22 pm
by lovelf
That is the proper way, thank you. :drunk: