I'm looking to add expire headers to my website so I can set a cache time for the files.
I've found the following the example, but I'd like to set it to only cache JPG, PNG, GIF, JS and CSS files if possible?
<system.webServer>
<staticContent>
<clientCache cacheControlMaxAge="14.00:00:00" cacheControlMode="UseMaxAge"/>
</staticContent>
</system.webServer>
Thanks for any help!
What you can do is to create web.config files in the folders where your files are. (You might have folder such "Images" for images and "Js" for javascript files, "Css" for style sheets... etc.) Then, you paste yor code in those files. By doing that you apply your cache settigs to all files in those folders, regardless of the file type. This is more flexible method than applying cache settings to a particular file extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With