利用浏览器缓存不起作用

时间:2016-05-20 19:57:50

标签: .htaccess caching browser-cache pagespeed

我知道我的htaccess文件正在被Google Pagespeed正确读取(它正确读取我已启用压缩,当我删除文件时它表示我没有启用压缩),但它无法读取我已启用浏览器缓存。我的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 ##

谢谢!

1 个答案:

答案 0 :(得分:0)

您必须启用enable mod_expires。输入此命令并重新启动apache server:

$('body').append('<div id="maindiv"></div>');
$('#maindiv').append('<select id="ddww" class="selectoption"></select>');
$('#ddww').append('<option value="" selected>Degree option</option>');
//all other options