设置到期标题的字体不工作 [英] Setting expire headers for fonts not working

查看:166
本文介绍了设置到期标题的字体不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在用的是跌破code。在我的.htaccess文件,试图设置过期头的一些字体,但在检查我的Firefox缓存和检查过期标题它的字体设置为过期在约12小时从现在;不是1年,我想将它设置为。

I am using the below code in my .htaccess file to try and set the expire headers for some fonts, but upon checking my firefox cache and checking the expire header it the font is set to expire in about 12 hours from now; not the 1 year I am trying to set it to.

下面是我的code:

# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg

# Compress compressible fonts
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml

# Add a far future Expires header for fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"

我是什么做错了吗?

What am I doing wrong?

推荐答案

好了,终于找到了解决的办法,看来我必须包括该位,以及:

Ok, finally found a solution to it, seems I had to include this bit as well:

ExpiresActive on

随着全code是:

With the full code being:

# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg

# Compress compressible fonts
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml

ExpiresActive on

# Add a far future Expires header for fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"

希望这可以帮助别人!

Hope this helps someone else!

这篇关于设置到期标题的字体不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆