Title: [Plugin: WP Super Cache] &#8211; adding max-age for images/css
Last modified: August 20, 2016

---

# [Plugin: WP Super Cache] – adding max-age for images/css

 *  Resolved [damaha](https://wordpress.org/support/users/damaha/)
 * (@damaha)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-adding-max-age-for-imagescss/)
 * Hi,
 * I use the mod-rewrite option in WP Super Cache, it seems to work.
 * As the plugin does not add expiry dates or max-age for images or css, I modified
   the .htaccess file in the cache folder (wp-content/cache/) manually and added
   max-ages for images and css. (I cannot use the expiry module with my virtual 
   server, so I cannot add expiry dates.)
 * I added the following code to the .htaccess file in the cache folder:
 *     ```
       # BEGIN Cache-Control Headers
       <ifmodule mod_headers.c>
         <filesmatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
               Header set Cache-Control "max-age=86400"
         </filesmatch>
         <filesmatch "\.(css|pdf)$">
               Header set Cache-Control "max-age=86400"
         </filesmatch>
         <filesmatch "\.(js)$">
               Header set Cache-Control "max-age=86400, private"
         </filesmatch>
       </ifmodule>
       ```
   
 * The whole file now looks like this:
    [http://pastebin.com/B4WGnTjM](http://pastebin.com/B4WGnTjM)
 * But when I check the browser caching of static assets, I still get the message:
   No max-age or expires for the images and the css file.
 * Can anyone please help?
    Many thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [damaha](https://wordpress.org/support/users/damaha/)
 * (@damaha)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-adding-max-age-for-imagescss/#post-2235633)
 * You can look at my WordPress-site under [http://www.trustablegold.de](http://www.trustablegold.de).
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-adding-max-age-for-imagescss/#post-2235652)
 * Add that code to your main .htaccess file as images and css aren’t cached!
 *  Thread Starter [damaha](https://wordpress.org/support/users/damaha/)
 * (@damaha)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-adding-max-age-for-imagescss/#post-2235665)
 * Great, it seems to work now.
    Thanks a lot!!
 *  [Tony Zeoli](https://wordpress.org/support/users/tonyzeoli/)
 * (@tonyzeoli)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-adding-max-age-for-imagescss/#post-2236016)
 * I just want to confirm that it’s not possible to set caching time limits for 
   CSS and JS, especially when you’re using a CDN.
 * But, now that I’ve seen this, I guess we can write the rules to .htaccess.
 * What is the recommended time to set CSS or JS. I see you have here 1 day or 86400
   seconds. Any recommendation on how long to set it to if you’re using a CDN.
 *  [Tony Zeoli](https://wordpress.org/support/users/tonyzeoli/)
 * (@tonyzeoli)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-adding-max-age-for-imagescss/#post-2236017)
 * This is resolved. I got the answer on the IRC channel from Donncha.
 * Settings are what you’re comfortable with.
 * We’re going with 172800 (2 days) for CSS and JS and images at 600 seconds (10
   min) because we’re a news org that updates stories with images frequently.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: WP Super Cache] – adding max-age for images/css’ is closed to
new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

## Tags

 * [browser cache](https://wordpress.org/support/topic-tag/browser-cache/)
 * [css](https://wordpress.org/support/topic-tag/css/)
 * [htaccess](https://wordpress.org/support/topic-tag/htaccess/)
 * [images](https://wordpress.org/support/topic-tag/images/)
 * [max-age](https://wordpress.org/support/topic-tag/max-age/)

 * 5 replies
 * 3 participants
 * Last reply from: [Tony Zeoli](https://wordpress.org/support/users/tonyzeoli/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-adding-max-age-for-imagescss/#post-2236017)
 * Status: resolved