Meta和.htaccess中的缓存控制优化

Meta和.htaccess中的缓存控制优化,.htaccess,caching,browser-cache,meta-tags,cache-control,.htaccess,Caching,Browser Cache,Meta Tags,Cache Control,我们想学习和优化我们的网站缓存,我们有以下代码 在meta中,我们有: 第1-10页 <meta http-equiv="Cache-control" content="max-age=2592000, public"> 您认为.htaccess文件中的头unset ETag会是 必要吗 我不知道为什么我们会得到页面的Pragma:no cache 因为我们在第1页有,所以在回复中有1个 我们是否有任何地方做错了,并且可以以更好的方式进行优化/更改 ExpriesByTyp

我们想学习和优化我们的网站缓存,我们有以下代码

在meta中,我们有:

第1-10页

    <meta http-equiv="Cache-control" content="max-age=2592000, public">
  • 您认为.htaccess文件中的
    头unset ETag
    会是 必要吗
  • 我不知道为什么我们会得到页面的
    Pragma:no cache
    因为我们在第1页有
    ,所以在回复中有1个
  • 我们是否有任何地方做错了,并且可以以更好的方式进行优化/更改
  • ExpriesByTyps中必须同时包含
    image/jpeg
    image/jpg
    。如有任何其他意见,我们将不胜感激
  • 感谢您的时间,

    ad2)–真实HTTP响应头和
    meta HTTP equiv
    之间存在差异–前两个具有优先权。
        <meta http-equiv="Cache-control" content="max-age=604800, private">
    
        <meta http-equiv="Cache-control" content="max-age=3600, private">
    
        <meta http-equiv="Pragma" content="no-cache" />
        <meta http-equiv="expires" content="0" />
    
    #### Expires By Type
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access plus 60 seconds"
        ExpiresByType image/x-icon "access plus 29030400 seconds"
        ExpiresByType image/jpeg "access plus 29030400 seconds"
        ExpiresByType image/jpg "access plus 29030400 seconds"
        ExpiresByType image/png "access plus 29030400 seconds"
        ExpiresByType image/gif "access plus 29030400 seconds"
        ExpiresByType application/x-shockwave-flash "access plus 29030400 seconds"
        ExpiresByType text/css "access plus 2592000 seconds"
        ExpiresByType text/javascript "access plus 2592000 seconds"
        ExpiresByType application/x-javascript "access plus 2592000 seconds"
        ExpiresByType text/html "access plus 600 seconds"
        ExpiresByType application/xhtml+xml "access plus 600 seconds"
    </IfModule>
    
    #### Cache-Control
    <IfModule mod_headers.c>
        <FilesMatch "\\.(ico|jpe?g|png|gif|swf)$">
            Header set Cache-Control "max-age=29030400, public"
            Header set Last-Modified "Mon, 24 Mar 2014 00:00:00 GMT"
        </FilesMatch>
        <FilesMatch "\\.(css|js)$">
            Header set Cache-Control "max-age=2592000, public"
            Header set Last-Modified "Mon, 24 Mar 2014 00:00:00 GMT"
        </FilesMatch>
        <FilesMatch "\\.(x?html?|php|xml)$">
            Header set Cache-Control "max-age=600, private, must-revalidate"
            Header set Last-Modified "Mon, 24 Mar 2014 00:00:00 GMT"
        </FilesMatch>
    </IfModule>
    
    #### ETags
    <IfModule mod_headers.c>
        Header unset ETag
    </IfModule>
    FileETag None
    
    HTTP/1.1 200 OK
        Date: Mon, 24 Mar 2014 14:14:50 GMT
        Server: Apache
        X-Powered-By: PHP/5.3.17
        Expires: Thu, 19 Nov 1981 08:52:00 GMT
        Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
            check=0
        Pragma: no-cache
        Vary: Accept-Encoding,User-Agent
        Content-Encoding: gzip
        Cache-Control: max-age=600, private, must-revalidate
        Last-Modified: Mon, 24 Mar 2014 00:00:00 GMT
        Keep-Alive: timeout=2, max=100
        Connection: Keep-Alive
        Transfer-Encoding: chunked
        Content-Type: text/html; charset=UTF-8