利用浏览器缓存,如何在Apache或htaccess的?缓存、浏览器、如何在、htaccess

2023-09-02 00:23:54 作者:Incurable 不能治愈

不知道这里做什么?我有一个巨大的文件,谷歌速度Page为利用浏览器缓存之称的名单。但我不知道怎么样?难道我乱或修改Apache的配置文件(如下所示)还是我把东西在我的.htaccess页?

感谢这么多!

 < IfModule mod_proxy.c>
        将ProxyRequests关闭
        CacheRoot的/ var /运行/代理
        CacheSize的1024
        CacheGcInterval 24
    #CacheMaxExpire 24
    #CacheLastModifiedFactor 0.1
    #CacheDefaultExpire 1
    #NoCache a_domain.com another_domain.edu joes.garage_sale.com
        <目录disabled_proxy>
            从example.com允许
            所有拒绝
            订单拒绝,允许
        < /目录>
    < / IfModule>
    ##
    #### mod_expires构造成使得所有静态文件,但图像
    60秒后####过期。有更多的寿命的任何响应
    ####超过5秒(见webperfcache.conf)将由webperfcache被缓存。
    ####请确保您的CGI返回一个缓存控制:无缓存标头,如果你
    ####选择,让您的动态生成的HTML页面不能缓存能。
    ####如果所有的HTML网页是静态的,你也可能会增加ExpiresDefault。

    < IfModule mod_expires.c>
        ExpiresActive在
        ExpiresDefault A60
        ExpiresByType图像/ BMP A3600
        ExpiresByType图像/ GIF A3600
        ExpiresByType图像/ IEF A3600
        ExpiresByType为image / jpeg A3600
        ExpiresByType图像/ PNG A3600
        ExpiresByType图像/ TIFF A3600
        ExpiresByType图像/ X-CMU-光栅A3600
        ExpiresByType图像/ X-便携式anymap A3600
        ExpiresByType图像/ X-便携式位图A3600
        ExpiresByType图像/ X-便携式graymap的A3600
        ExpiresByType图像/ X-便携式像素图A3600
        ExpiresByType图像/ X-RGB A3600
        ExpiresByType图像/ X-xbitmap A3600
        ExpiresByType图像/ X-xpixmap A3600
        ExpiresByType图像/ X-xwindowdump A3600
        ExpiresByType音频/基本A3600
        ExpiresByType音频/ MIDI A3600
        ExpiresByType音频/ MPEG A3600
        ExpiresByType音频/ X-AIFF A3600
        ExpiresByType音频/ X-PN-的RealAudio A3600
        ExpiresByType音频/ X-PN-的RealAudio,插件A3600
        ExpiresByType音频/ X-的RealAudio A3600
        ExpiresByType音频/ X-WAV A3600
        ExpiresByType视频/ MPEG A3600
        ExpiresByType视频/ QuickTime的A3600
        ExpiresByType视频/ X-msvideo A3600
        ExpiresByType视频/ X-SGI-电影A3600
    < / IfModule>
 

解决方案

我前两天做同样的事情。添加了这个给我的.htaccess文件:

  ExpiresActive开
ExpiresByType图像/ GIF A2592000
ExpiresByType为image / jpeg A2592000
ExpiresByType图像/ JPG A2592000
ExpiresByType图像/ PNG A2592000
ExpiresByType图像/ X-图标A2592000
ExpiresByType文/ CSS A86400
ExpiresByType文/ JavaScript的A86400
ExpiresByType应用程序/ x-冲击波闪光A2592000
#
< FilesMatch(gif|jpe g|png|ico|css|js|swf?)$。>
头集缓存控制公共
< / FilesMatch>
 

而现在,当我运行谷歌网页的速度,杠杆browwer缓存不再是一个高优先级。

希望这有助于。

如何清理IE浏览器的缓存

Not sure what to do here?? I have a huge list of files that Google Speed Page said to "Leverage Browser Caching".. but I don't know how? Do I mess or change the Apache config file (below) or do I put something in my .htaccess page?

Thanks so much!!

 <IfModule mod_proxy.c>
        ProxyRequests Off
        CacheRoot "/var/run/proxy"
        CacheSize 1024
        CacheGcInterval 24
    #CacheMaxExpire 24
    #CacheLastModifiedFactor 0.1
    #CacheDefaultExpire 1
    #NoCache a_domain.com another_domain.edu joes.garage_sale.com
        <Directory "disabled_proxy">
            Allow from example.com
            Deny from all
            Order Deny,Allow
        </Directory>
    </IfModule>
    ##
    #### mod_expires is configured so that all static files but images
    #### expire after 60 seconds. Any response that has a life span of more
    #### than 5 seconds (see webperfcache.conf) will be cached by webperfcache.
    #### Make sure your CGIs return a "Cache-Control: no-cache" header if you
    #### elect to make your dynamically generated HTML pages not cache-able.
    #### If all your HTML pages are static you may also increase ExpiresDefault.

    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault A60
        ExpiresByType image/bmp A3600
        ExpiresByType image/gif A3600
        ExpiresByType image/ief A3600
        ExpiresByType image/jpeg A3600
        ExpiresByType image/png A3600
        ExpiresByType image/tiff A3600
        ExpiresByType image/x-cmu-raster A3600
        ExpiresByType image/x-portable-anymap A3600
        ExpiresByType image/x-portable-bitmap A3600
        ExpiresByType image/x-portable-graymap A3600
        ExpiresByType image/x-portable-pixmap A3600
        ExpiresByType image/x-rgb  A3600
        ExpiresByType image/x-xbitmap A3600
        ExpiresByType image/x-xpixmap A3600
        ExpiresByType image/x-xwindowdump A3600
        ExpiresByType audio/basic A3600
        ExpiresByType audio/midi A3600
        ExpiresByType audio/mpeg A3600
        ExpiresByType audio/x-aiff A3600
        ExpiresByType audio/x-pn-realaudio A3600
        ExpiresByType audio/x-pn-realaudio-plugin A3600
        ExpiresByType audio/x-realaudio A3600
        ExpiresByType audio/x-wav A3600
        ExpiresByType video/mpeg A3600
        ExpiresByType video/quicktime A3600
        ExpiresByType video/x-msvideo A3600
        ExpiresByType video/x-sgi-movie A3600
    </IfModule>

解决方案

I was doing the same thing a couple days ago. Added this to my .htaccess file:

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType text/css A86400
ExpiresByType text/javascript A86400
ExpiresByType application/x-shockwave-flash A2592000
#
<FilesMatch ".(gif¦jpe?g¦png¦ico¦css¦js¦swf)$">
Header set Cache-Control "public"
</FilesMatch>

And now when I run google speed page, leverage browwer caching is no longer a high priority.

Hope this helps.

 
精彩推荐
图片推荐