Forum Moderators: phranque
On stable developed sites, I use 6 to 12 hours for robots.txt, pages, and scripts, 30 days for images, and 0 seconds for custom error pages. - jdMorgan
ExpiresActive On
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpg "access plus 30 days"
ExpiresByType text/html "access plus 6 hours"
ExpiresByType text/txt "access plus 6 hours"
ExpiresByType text/php "access plus 6 hours"
ExpiresByType text/js "access plus 6 hours"
ExpiresByType text/pl "access plus 6 hours"
ExpiresByType error.html "now"
ExpiresByType forbidden.html "now"
ExpiresActive On
# Set default expiry to six hours after last access
ExpiresDefault A21600
# Set expiry for image files to 30 days
ExpiresByType image/gif A2592000
ExpiresByType image/jpg "access plus 30 days"
# Set expiry for error pages to zero
<FilesMatch "^(error¦forbidden)\.html$">
ExpiresDefault A0
</FilesMatch>
So you're saying that this is about as succinct as I can get it then?
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpg A2592000
ExpiresByType text/html A21600
ExpiresByType text/txt A21600
ExpiresByType text/php A21600
ExpiresByType text/js A21600
<FilesMatch "^(error¦authentication¦forbidden)\.html$">
ExpiresDefault A0
</FilesMatch>
<added>
what "type" would pdf, wav and mid files be?
</added>
ExpiresActive On
ExpiresDefault A21600
ExpiresByType image/gif A2592000
ExpiresByType image/jpg "access plus 30 days"
<FilesMatch "^(error¦forbidden¦authentication)\.html$">
ExpiresDefault A0
</FilesMatch>
ExpiresDefault A21600 But why the two different time syntaxes?
ExpiresByType image/gif [b]A2592000[/b]
ExpiresByType image/jpg [b]"access plus 30 days"[/b]
ExpiresByType image/gif [b]A2592000[/b]
ExpiresByType image/jpg [b]A2592000[/b]
<added>
Actually, testing with the SearchEnginesWorld Server Header Checker [searchengineworld.com] shows everything expiring as indicated except .jpg files, which are defaulting to the 6 hour limit. This is true using A2592000 or "access plus 30 days"
It seems these MIME type names were established before JPEG diversed into the abbreviated "JPG."
So this now fixes it:
ExpiresByType image/jpeg A2592000