静态映像上的缓存过期 [英] Cache Expiration On Static Images

查看:50
本文介绍了静态映像上的缓存过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用html5的php站点,该站点在godaddy的linux服务器上运行.我需要在静态图片和CSS文件上设置缓存过期日期.我还需要gzip一个css文件,并且似乎找不到正确的语法.我不确定是否要使它变得太复杂或什么.我是否正确认为自己可以通过php页面顶部的expire标头完成此操作?我感到迷茫,我知道自己在做什么!我无法控制服务器.

I have a php site using html5 run on a linux server on godaddy. I need to set a cache expiration date on static images and a css file. I also need to gzip a css file and cannot seem to find the correct syntax for either. I am not sure if I am making this too complicated or what. Am I correct to think I can get this done with an expire header in the top of my php pages? I feel lost and I know what i am doing! I do not have control over the server.

推荐答案

如果您可以控制服务器,那么这绝对是可能的;如果您在共享主机上,则可以通过.htaccess.

This is definitely possible if you have control over the server, and maybe possible through .htaccess if you're on shared hosting.

尝试这些SO问题:

  • How to gzip my files
  • How to set the cache expiry period of a whole folder of jpgs using .htaccess
  • Why isn’t my javascript & css caching ? (With full examples)

这篇关于静态映像上的缓存过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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