Dudu
Dudu

Reputation: 1184

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 cached specific file?

Upvotes: 10

Views: 8074

Answers (2)

Saahithyan Vigneswaran
Saahithyan Vigneswaran

Reputation: 7143

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.

Upvotes: 0

liran
liran

Reputation: 126

  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

Upvotes: 11

Related Questions