Title: Cache CSS, JS &amp; Images Only
Last modified: February 22, 2019

---

# Cache CSS, JS & Images Only

 *  Resolved [Satinder Singh](https://wordpress.org/support/users/satindersingh/)
 * (@satindersingh)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/cache-css-js-images-only/)
 * Can I activate cache only for CSS, JS and Images not for whole page?

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

 *  Plugin Contributor [Fred](https://wordpress.org/support/users/fredawd/)
 * (@fredawd)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/cache-css-js-images-only/#post-11237468)
 * **No**. The only method is to set HTTP headers, specifically these ones: “Expires”,“
   Last-Modified”, and “Cache-Control” regarding Browser caching, or use a CDN for
   those files.
 *  Thread Starter [Satinder Singh](https://wordpress.org/support/users/satindersingh/)
 * (@satindersingh)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/cache-css-js-images-only/#post-11238349)
 * **OK**
 * I added below lines in custom htaccess section and it is working fine.
 *     ```
       <IfModule mod_expires.c>
       ExpiresActive On
       ExpiresDefault A2592000
   
       <FilesMatch "\.(txt|xml|js)$">
       ExpiresDefault A2592000
       </FilesMatch>
   
       <FilesMatch "\.(css)$">
       ExpiresDefault A2592000
       </FilesMatch>
   
       <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
       ExpiresDefault A2592000
       </FilesMatch>
   
       <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
       ExpiresDefault A2592000
       </FilesMatch>
       </IfModule>
   
       <IfModule mod_headers.c>
         <FilesMatch "\.(txt|xml|js)$">
          Header set Cache-Control "max-age=2592000"
         </FilesMatch>
   
         <FilesMatch "\.(css)$">
          Header set Cache-Control "max-age=2592000"
         </FilesMatch>
   
         <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
          Header set Cache-Control "max-age=2592000"
         </FilesMatch>
   
         <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
          Header set Cache-Control "max-age=2592000"
         </FilesMatch>
       </IfModule>
       ```
   

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

The topic ‘Cache CSS, JS & Images Only’ is closed to new replies.

 * ![](https://ps.w.org/swift-performance-lite/assets/icon-256x256.jpg?rev=2388229)
 * [Swift Performance Lite](https://wordpress.org/plugins/swift-performance-lite/)
 * [Support Threads](https://wordpress.org/support/plugin/swift-performance-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/swift-performance-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/swift-performance-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/swift-performance-lite/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Satinder Singh](https://wordpress.org/support/users/satindersingh/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/cache-css-js-images-only/#post-11238349)
 * Status: resolved