powtac Asked: 2009-11-28 07:49:42 +0800 CST2009-11-28 07:49:42 +0800 CST 2009-11-28 07:49:42 +0800 CST Expires header for specific file types 772 How can I add an expires header just for pngs, and the ico file? apache-2.2 2 Answers Voted BastianW 2012-06-11T13:26:51+08:002012-06-11T13:26:51+08:00 Example (for the htaccess file): # Cache the following content for 1 month (4 Weeks) <FilesMatch "\.(jpg|jpeg|png|gif|ico)$"> Header set Cache-Control "max-age=2419200, public" </FilesMatch> Best Answer Jeff Snider 2009-11-28T09:37:14+08:002009-11-28T09:37:14+08:00 Use the ExpiresByType directive of mod_expires. Docs here. ExpiresActive On # expire after a month ExpiresByType image/png A2592000 ExpiresByType image/x-icon A2592000
Example (for the htaccess file):
Use the
ExpiresByType
directive of mod_expires. Docs here.