Optimizing javascript and css requests

后端 未结 11 1785
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 17:21

I need to optimize the loading speed of several existing websites. One of the issues that I have is the amount of requests per page. The websites have 7 or more different ty

11条回答
  •  有刺的猬
    2020-12-31 17:36

    One thing you should do is optimize your .htaccess file to compress and cache files properly:

    # compress text, html, javascript, css, xml:  
    AddOutputFilterByType DEFLATE text/plain  
    AddOutputFilterByType DEFLATE text/html  
    AddOutputFilterByType DEFLATE text/xml  
    AddOutputFilterByType DEFLATE text/css  
    AddOutputFilterByType DEFLATE application/xml  
    AddOutputFilterByType DEFLATE application/xhtml+xml  
    AddOutputFilterByType DEFLATE application/rss+xml  
    AddOutputFilterByType DEFLATE application/javascript  
    AddOutputFilterByType DEFLATE application/x-javascript
    
    # cache media files
      
    Header set Cache-Control "max-age=2592000"  
     
    

提交回复
热议问题