开发者

iis only Add Expires headers to images

Add expires headers in iis is very Easy,but this cache all the static files. now i want only add expires headers to images,how can i do that? even i want cac开发者_Go百科hed specific file?


  1. put all your images in one folder
  2. enter the manager--> yoursite--> images folder (or specific file)
  3. right click--> HTTP HEADERs--> Set expire header/date ! --> APPLY/OK


I've been searching for a simpler solution and I found this.

Keep your static content inside a folder (eg: css, js). Create a web.config file inside that folder. Add these following lines. Here 7 is the number of days, change it as you desire.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
        </staticContent>
    </system.webServer>
</configuration>

You are free to keep as many static content folder as you want, simply add this web.config file. Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜