簡體   English   中英

利用瀏覽器緩存

[英]Leverage browser caching

根據: http//code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching我應該使用瀏覽器緩存。 但是,我不知道怎么做。

我只是在html部分添加某些標簽嗎? 或者是我需要通過服務器發送給客戶端的東西? 與php標題有關嗎?

緩存由各種HTTP標頭控制。 您應該閱讀Mark Nottingham的Web作者和網站管理員緩存教程 您可以使用標頭功能為從PHP輸出的文檔設置HTTP標

您可以在.htaccess中執行類似的操作。

  ## EXPIRES CACHING ##
<IfModule mod_expires>
ExpiresActive On
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 application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
  ## EXPIRES CACHING ##

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM