2016-04-28 91 views
0

我想添加槓桿瀏覽器緩存在我的站點。
我在下面我.htaccess文件添加代碼:如何添加槓桿瀏覽器緩存到我的WordPress站點

## 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 ## 

,但我不能夠解決這個問題。
請幫我解決它。

回答

0

這看起來正確的我,雖然我通常不喜歡這樣:

<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」模塊?

+0

我正在使用IIS server.is它支持「mod_expires」mudule?我怎麼檢查它? – piyush