Q
槓桿瀏覽器緩存
5
A
回答
15
編輯.htaccess
和追加
<IfModule mod_expires.c>
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"
</IfModule>
這個鏈接可以幫助你: http://www.quickonlinetips.com/archives/2010/05/leverage-browser-caching-increase-website-speed/
2
槓桿瀏覽器緩存
從您的網站上存儲常用的文件減少頁面的加載時間在您的訪客瀏覽器上。
要啓用瀏覽器緩存,您需要編輯您的HTTP標頭以設置特定類型文件的到期日期。
在你的域的根目錄下找到你的.htaccess文件,這個文件是一個隱藏文件,但是應該顯示在FileZilla或CORE等FTP客戶端中。您可以使用記事本或任何形式的基本文本編輯器來編輯htaccess文件。
在這個文件中,我們將設置我們的緩存參數來告訴瀏覽器緩存什麼類型的文件。
下面的代碼告訴瀏覽器要緩存什麼以及「記住」它需要多長時間。它應該被添加到.htaccess文件的頂部。
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
<IfModule>
## EXPIRES CACHING ##
建議:
- 是積極與緩存所有的靜態資源
- 到期至少一個月
- 不要設置你的緩存一年多的時間中提前!
參考:http://websitespeedoptimizations.com/LeverageBrowserCaching.aspx
+0
只是爲了讓您知道該網址無效。我現在在這裏閱讀https://varvy.com/pagespeed/leverage-browser-caching.html – ChristinaD 2017-08-04 05:53:51
相關問題
- 1. 槓桿瀏覽器緩存
- 2. 槓桿瀏覽器緩存
- 3. 槓桿瀏覽器緩存的問題
- 4. 槓桿瀏覽器緩存asp.net
- 5. 槓桿瀏覽器緩存JS
- 6. 槓桿瀏覽器緩存不緩存JavaScript和CSS文件
- 7. 網站速度和槓桿瀏覽器緩存
- 8. 槓桿瀏覽器緩存django-nginx不工作
- 9. Apache服務器壓縮和槓桿瀏覽緩存問題
- 10. 槓桿瀏覽器緩存的最佳值?
- 11. 槓桿瀏覽器緩存的.htaccess不工作
- 12. 槓桿瀏覽器緩存IIS - GTMetric仍然給˚F
- 13. 添加槓桿瀏覽器緩存到Facebook部件
- 14. htaccess的槓桿瀏覽器緩存圖像
- 15. 如何設置槓桿瀏覽器緩存asp.net
- 16. 如何提高槓杆瀏覽器緩存
- 17. 在軌道上的紅寶石3.1槓桿瀏覽器緩存
- 18. GoogleSpeed洞察力槓桿瀏覽器緩存
- 19. 如何添加槓桿瀏覽器緩存到我的WordPress站點
- 20. 「槓桿瀏覽器緩存」不是IIS或Page Speed的工作報告錯誤
- 21. 槓桿瀏覽器緩存 - 過期或最大年齡,最後修改或etag
- 22. 緩存。瀏覽器VS Rails的緩存
- 23. 瀏覽器緩存或磁盤緩存?
- 24. 控制瀏覽器緩存
- 25. 利用瀏覽器緩存
- 26. CSS瀏覽器緩存
- 27. 瀏覽器臨時緩存
- 28. 操作瀏覽器緩存
- 29. 寫入瀏覽器緩存
- 30. History.go和瀏覽器緩存
你是什麼平臺? (IIS,Apache等...)?它指的是什麼類型的文件? – 2010-04-14 00:44:51
umm?我與wordpress和godaddy博客。我想說Apache。 – Daniel 2010-04-14 01:31:24