1
我已經添加過期頭到我的.htaccess文件:添加Expires頭與查詢字符串
## EXPIRES CACHING ##
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"
## EXPIRES CACHING ##
但gtmetrix說:「有沒有30種遠的將來到期日期靜態成分。」
我意識到所有包含查詢字符串的文件都不包含在內以進行緩存。例如:
history.js?ver=1.7.1
history.adapter.jquery.js?ver=1.7.1
jquery.form.min.js?ver=3.48.0-2013.12.28
respond.min.js?ver=3.8.1
如何爲這些文件添加緩存?
謝謝。