开发者

How to set the cache expiry period of a whole folder of jpgs using .htaccess

开发者 https://www.devze.com 2022-12-12 03:15 出处:网络
How can I set the cache expiry date of a whole folder of images using .htaccess? Right now, I only want the contents of one specific folder to be given a long cache expiry date.I\'m currently using t

How can I set the cache expiry date of a whole folder of images using .htaccess?

Right now, I only want the contents of one specific folder to be given a long cache expiry date. I'm currently using the following code (pasted below), but 开发者_如何学编程I find it a pain because every time I add a new piece of art, I have to add it to this list. Is there a way I can just specify the entire folder?

<FilesMatch" (\.css|main_banner.jpg|cart.png|main_logo.jpg|favicon.ico|search_button.jpg|fp_banner.jpg)$">
   Header set Cache-Control "max-age=2592000"
</FilesMatch> 


Just put the .htaccess file in that folder. Then all you need is the Header set Cache-Control "max-age=2592000" directive, without worrying about the FilesMatch condition.

0

精彩评论

暂无评论...
验证码 换一张
取 消