为浏览器缓存启用mod_expires

时间:2017-11-21 19:34:13

标签: apache .htaccess caching browser-cache

htaccess文件如下所示:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]




</IfModule>
<IfModule mod_expires.c>


# Enable expirations
ExpiresActive On 
# Default directive
ExpiresDefault "access plus 1 month"

# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
# CSS
ExpiresByType text/css "access plus 1 week"
# Javascript
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/html "access plus 1 day"
</IfModule>

# END WordPress

为什么这不能启用浏览器缓存?我正在运行Centos 5并确保安装了expires模块。

0 个答案:

没有答案