【问题标题】:How to set up mod expires for fonts如何设置字体的mod过期
【发布时间】:2016-07-03 01:33:41
【问题描述】:

我想设置字体的到期日期。以下定义不适用于apache 2.2.15

ExpiresByType application/x-font-woff       "access plus 1 month"
ExpiresByType application/font-woff2         "access plus 1 month"

【问题讨论】:

    标签: apache mod-expires


    【解决方案1】:

    首先,添加正确的 MIME 类型定义:

    AddType application/font-sfnt            otf ttf
    AddType application/font-woff            woff
    AddType application/font-woff2           woff2
    AddType application/vnd.ms-fontobject    eot
    

    接下来,将配置行更改为:

    ExpiresByType application/font-woff "access plus 1 month" 
    ExpiresByType application/font-woff2 "access plus 1 month"
    ExpiresByType application/font-sfnt "access plus 1 month"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    

    【讨论】:

    • 如果您对答案感到满意,请将其标记为正确 :) 谢谢。
    【解决方案2】:

    我发现使用文件扩展名比使用我的类型更容易,尤其是Woff mime type changed a few times

    # Set up caching on font files for 6 months (60 * 60 * 24 * 180 = 15724800)
    <filesMatch ".([eE][oO][tT]|[tT][tT][fF]|[sS][vV][gG]|[Ww][Oo][Ff][Ff]|[Ww][Oo][Ff][Ff]2)$">
       ExpiresDefault A15724800
       Header append Cache-Control "public"
    </filesMatch>
    

    【讨论】:

      猜你喜欢
      • 2017-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-23
      • 2017-02-20
      相关资源
      最近更新 更多