0

I need to set cache control headers for index.htm files Unfortunately the following configuration does not work. The reason when the user access “/” in a browser the server response with index.htm even it does not appear in the request.

<filesMatch "(index.htm)$">
  <ifModule mod_headers.c>
      Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
      Header set Pragma "no-cache"
      Header set Expires 0
  </ifModule>
</filesMatch>

How can I set cache control cookies?

eckes
  • 845
  • 9
  • 21
Michael
  • 597
  • 3
  • 9
  • 23

1 Answers1

2

Use LocationMatch instead of FilesMatch:

<LocationMatch "(\/|index\.(htm|html))$">
    <ifModule mod_headers.c>
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires 0
    </ifModule>
</LocationMatch>
Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129