Caching and gzip compression by htaccess

前端 未结 5 615
小鲜肉
小鲜肉 2020-12-12 18:05

Can someone provide me with an optimized .htaccess configuration that handles compression, browser caching, proxy caching, etc. for a typical website?

Aside from my

5条回答
  •  悲&欢浪女
    2020-12-12 18:56

    # 480 weeks
    
    Header set Cache-Control "max-age=290304000, public"
    
    
    # 2 DAYS
    
    Header set Cache-Control "max-age=172800, public, must-revalidate"
    
    
    # 2 HOURS
    
    Header set Cache-Control "max-age=7200, must-revalidate"
    
    
    
      mod_gzip_on Yes
      mod_gzip_dechunk Yes
      mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
      mod_gzip_item_include handler ^cgi-script$
      mod_gzip_item_include mime ^text/.*
      mod_gzip_item_include mime ^application/x-javascript.*
      mod_gzip_item_exclude mime ^image/.*
      mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    
    

提交回复
热议问题