[英]How to fix the leverage browser caching not working in the wordpress site hosted in AWS?
[英]How to add leverage browser caching to my wordpress site
我想在我的worpress網站中添加杠桿瀏覽器緩存。
我在下面的.htaccess
文件中添加了代碼:
## EXPIRES CACHING ##
<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 text/html "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 1 month"
</IfModule>
## EXPIRES CACHING ##
但我無法解決。
請幫我解決。
這對我來說似乎是正確的,盡管我通常這樣做是這樣的:
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault A60
# Font files expire in 1 year
ExpiresByType font/otf A31449600
ExpiresByType font/x-woff A31449600
ExpiresByType application/font-woff2 A31449600
ExpiresByType font/ttf A31449600
# Image files expire in 1 month
ExpiresByType image/x-icon A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/gif A2592000
ExpiresByType application/x-shockwave-flash A2592000
# Stylesheet & Javascript files expire in 1 week
ExpiresByType text/css A604800
ExpiresByType text/javascript A604800
ExpiresByType application/javascript A604800
ExpiresByType application/x-javascript A604800
# HTML files do not expire
ExpiresByType text/html A0
ExpiresByType application/xhtml+xml A0
</ifModule>
您確定主機支持“ mod_expires”模塊嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.