Image Caching
-
Hi, this looks like a great plugin. I wondering if you could clarify a few things for me?
1) This plugin tells my CDN how long to cache a page for? Is that correct? So if i have a page that never changes once published, i could set a long cache time such as 1 month?
2) What do you mean by the following at the bottom of your plugin options:
“You should also set Cache-Control headers manually in your webserver configuration for images, scripts, stylesheets, and other static resources.”
So if i create a page and it is cached by a caching plugin (e.g., WP Super Cache) will your plugin then not apply to all images, css, JS on that cached page?
Currently i have browser caching enabled in htaccess as follows:
## EXPIRES CACHING ## <IfModule mod_expires.c> # Add correct content-type for fonts AddType application/vnd.ms-fontobject .eot AddType application/x-font-ttf .ttf AddType application/x-font-opentype .otf AddType application/x-font-woff .woff AddType image/svg+xml .svg ExpiresActive On ExpiresDefault "access 1 month" ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType image/webp "access 1 year" ExpiresByType image/ico "access 1 year" ExpiresByType image/x-icon "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/javascript "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType application/x-javascript "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType application/x-font-ttf "access plus 1 year" ExpiresByType application/x-font-opentype "access plus 1 year" ExpiresByType application/x-font-woff "access plus 1 year" ExpiresByType application/font-woff2 "access 1 month" ExpiresByType image/svg+xml "access plus 1 year" </IfModule> ## EXPIRES CACHING ## <IfModule mod_headers.c> Header unset Pragma Header unset ETag FileETag None Header set Connection keep-alive </IfModule>
To set cache control header for images would i then need to add the following to my htaccess? Or does your plugin already take care of this if a page is cached by something like WP Super Cache?
# 1 MONTHS <FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=2419200, public" ExpiresDefault "access plus 1 month" SetOutputFilter DEFLATE </FilesMatch>
Or is there no need to set the max-age directive with the cache-control header since it is already set by the mod_expires module for expires caching? As such:
# BEGIN Cache-Control Headers <ifModule mod_headers.c> <filesMatch "\.(ico|jpe?g|png|gif|swf)$"> Header set Cache-Control "public" </filesMatch> <filesMatch "\.(css)$"> Header set Cache-Control "public" </filesMatch> <filesMatch "\.(js)$"> Header set Cache-Control "public" </filesMatch> <filesMatch "\.(x?html?|php)$"> Header set Cache-Control "public" </filesMatch> </ifModule> # END Cache-Control Headers
- The topic ‘Image Caching’ is closed to new replies.