How do I set expiration on CSS, JS and Images?

前端 未结 5 1384
甜味超标
甜味超标 2021-01-30 07:06

I have recently analysed my website with pagespeed addon on firebug. It suggested me to set expiration on CSS, JS and image files.

I am wondering, how do I do this?

5条回答
  •  失恋的感觉
    2021-01-30 07:43

    This is the one I use to fix the exact same thing when I ran the PageSpeed Addon:

    
        Header set Cache-Control "max-age=604800, public"
    
    

    This goes into your .htaccess file.

    Read up on this page for more information about how to set cache for additional file types and/or change the cache length:

    http://www.askapache.com/htaccess/apache-speed-cache-control.html

提交回复
热议问题