Html 利用浏览器缓存不工作

Html 利用浏览器缓存不工作,html,css,.htaccess,caching,browser-cache,Html,Css,.htaccess,Caching,Browser Cache,我在.htaccess文件中有以下代码来利用浏览器缓存(和gzip),但是当我运行诸如Google Page speed或Gtmetrix之类的工具时,我仍然会发现我的网站没有使用浏览器缓存的错误 .htaccess代码: <FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|pdf|flv|mp3)$"> <IfModule mod_expires.c> ExpiresActive on ExpiresDefault

我在.htaccess文件中有以下代码来利用浏览器缓存(和gzip),但是当我运行诸如Google Page speed或Gtmetrix之类的工具时,我仍然会发现我的网站没有使用浏览器缓存的错误

.htaccess代码:

    <FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|pdf|flv|mp3)$">
<IfModule mod_expires.c>
 ExpiresActive on
 ExpiresDefault "access plus 14 days"
 Header set Cache-Control "public"

  # My favicon
ExpiresByType image/x-icon "access plus 1 year”

# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"

# CSS
ExpiresByType text/css "access 1 month”

# Javascript
ExpiresByType application/javascript "access plus 1 year"

</IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|xml|txt|xsl)$">
 Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>



<IfModule mod_mime.c>
 AddType application/x-javascript .js
 AddType text/css .css
</IfModule>
<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript
 <IfModule mod_setenvif.c>
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 </IfModule>
 <IfModule mod_headers.c>
  Header append Vary User-Agent env=!dont-vary
 </IfModule>
</IfModule>

SetOutputFilter DEFLATE
 <IfModule mod_setenvif.c>
  SetEnvIfNoCase Request_URI \.(?:rar|zip)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI \.(?:gif|jpg|png)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI \.(?:avi|mov|mp4)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary
 </IfModule>

过期于
ExpiresDefault“访问加14天”
标头集缓存控制“公共”
#我的favicon
过期按类型图像/x图标“访问加1年”
#图像
ExpiresByType image/gif“访问加1个月”
ExpiresByType图像/png“访问加1个月”
ExpiresByType图像/jpg“访问加1个月”
过期按类型图像/jpeg“访问加1个月”
#CSS
ExpiresByType文本/css“访问1个月”
#Javascript
ExpiresByType应用程序/javascript“访问加1年”
标题集缓存控制“最大年龄=7200,必须重新验证”
AddType应用程序/x-javascript.js
AddType text/css.css
AddOutputFilterByType DEFLATE text/css应用程序/x-javascript文本/x-component文本/html文本/richtext图像/svg+xml文本/纯文本/xsd文本/xsl文本/xml图像/x-icon应用程序/javascript
浏览器匹配^Mozilla/4 gzip纯文本/html
浏览器匹配^Mozilla/4\.0[678]无gzip
BrowserMatch\bMSIE!没有gzip!仅限gzip文本/html
标头附加变量用户代理env=!不要改变
SetOutputFilter放气
setEnvifLocase请求_URI\(?:rar | zip)$无gzip不变
SetEnvIfNoCase请求_URI\(?:gif | jpg | png)$no gzip不变
setEnvifLocase请求_URI\(?:avi | mov | mp4)$无gzip不变
SetEnvIfNoCase请求\u URI\.mp3$no gzip不变

我很困惑。检查站点时,您的服务器似乎是IIS(服务器:Microsoft IIS/8.5),而不是Apache。我还注意到缓存信息根本不能反映您在这里发布的内容。我找对地方了吗?@svpino是的,我安装了IIS管理器并设法解决了这个问题,谢谢