apache_conf 利用浏览器缓存

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf 利用浏览器缓存相关的知识,希望对你有一定的参考价值。

## LEVERAGE BROWSER CACHING ##
<IfModule mod_expires.c>
  ExpiresActive On
  
  # Add correct content-type for fonts
  AddType application/vnd.ms-fontobject .eot
  AddType application/x-font-ttf .ttf
  AddType application/x-font-opentype .otf
  AddType application/x-font-woff .woff
  AddType image/svg+xml .svg
  
  # Compress compressible fonts
  AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml
  
  # Common Types
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/javascript "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType application/x-javascript "access 1 month"
  ExpiresByType application/javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 2 days"
  
  # Add a far future Expires header for fonts
  ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
  ExpiresByType application/x-font-ttf "access plus 1 year"
  ExpiresByType application/x-font-opentype "access plus 1 year"
  ExpiresByType application/x-font-woff "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"

</IfModule>
## LEVERAGE BROWSER CACHING ##

## BEGIN Disable ETag header ##
  Header unset Pragma
  Header unset ETag
  FileETag None
## END Disable ETag header ##

## BEGIN Vary: Accept-Encoding Header ##
  <IfModule mod_headers.c>
    <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary: Accept-Encoding
    </FilesMatch>
  </IfModule>
## END Vary: Accept-Encoding Header ##

以上是关于apache_conf 利用浏览器缓存的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf 利用浏览器缓存

apache_conf 利用浏览器缓存

apache_conf 利用浏览器缓存

apache_conf htaccess:利用浏览器缓存的指令

apache_conf 通过htaccess利用浏览缓存。

apache_conf 通过htaccess利用浏览缓存。