如何使用mod_headers为index.htm文件设置Cache-Control标头?

我需要为index.htm文件设置caching控制标头。不幸的是,以下configuration不起作用。 当用户在浏览器中访问“/”时,服务器对index.htm的响应甚至没有出现在请求中。

<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> 

我怎样才能设置caching控制cookies?

使用LocationMatch代替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>