【问题标题】:Leverage browser caching in modx?在 modx 中利用浏览器缓存?
【发布时间】:2015-03-18 19:07:59
【问题描述】:

我对 modx 非常陌生,但已经多次“利用浏览器缓存”来处理其他 cms 的/静态页面。

我已经添加了这个:

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

到 public_html 文件夹中的 .htaccess 就像我对我的大多数网站所做的那样,谷歌说它不起作用。我还进入了 cms 本身并找到了 ht.access 文件并放入其中(它与 ftp 中的不同)。仍然没有运气。有什么想法吗?

【问题讨论】:

  • 在网络选项卡上的浏览器开发工具中检查响应标头。并查看图像的日期是否设置为 1 年。您还需要确保在服务器上启用了 mod_expires。
  • @PanamaJack 这就是我在图像的响应标头中得到的全部内容:HTTP/1.1 304 Not Modified 服务器:nginx/1.6.2 日期:2015 年 3 月 19 日星期四 12:35:03 GMT 最后-修改:格林威治标准时间 2013 年 2 月 27 日星期三 21:11:39 连接:keep-alive ETag:“512e768b-239a6”它是 nginx 有区别吗?

标签: php .htaccess modx


【解决方案1】:

问题似乎是您使用的是 nginx 而不是 Apache。

Leverage browser caching for Nginx

【讨论】:

    猜你喜欢
    • 2011-10-15
    • 1970-01-01
    • 2014-07-18
    • 1970-01-01
    • 2016-09-03
    • 2016-03-13
    相关资源
    最近更新 更多