Did you know about Media.AlwaysAppendRevision?

Yep, this is old news but apparently lots of people don’t know about this.

As you may know, when you replace an existing media item image with another one in Sitecore, if the new image is the same size as the older one, or if you are not appending the image dimension on the media item URL, you may run into a browser caching issue. That’s because even when you replace the image, the URL is the same. Therefore the browser will likely render the older version of the image because it is probably cached. If you’re using a CDN and think you’re safe from this issue, you’re not. This issue usually also affects your CDN, since it won’t be able to pull the updated image from the CD – again, because it is the same URL (at least until the CDN cache policy expires anyway).

So I was running into these issues and I noticed that the most common solution suggested for this is to override the Media Provider in order to append the revision and hash values as query string parameters to the media item URL. That way, every time the media item is updated, a new URL will be generated by the Media Provider for that media item, so cache problem solved!

This common solution is valid and great, but the good news is that starting on Sitecore 8.2 Update 5 there is a built-in setting that will do that for you:

<setting name="Media.AlwaysAppendRevision" value="false"/>

By default its value is false, if you set it to true you will start to see your media items URL looking something like this:


Note how out of the box, you will now get revision and hash values added to the URL.

Hope this helps!

Did you know about Media.AlwaysAppendRevision?
Tagged on:                     

2 thoughts on “Did you know about Media.AlwaysAppendRevision?

  • March 25, 2019 at 4:15 pm

    Thank you Geykel! This is a very valuable piece of information! I remember clients struggling often though with documents not being updated – last month catalog being presented, when intention is to have a new month catalog on the site for example. Question though: how do you satisfy SEO aspect for documents in Media Library, if it – as clients DO want the URL to stay the same, as it is also advertised in third party places and cannot be dynamic (with revision part added to it, etc)?

    • March 25, 2019 at 4:20 pm

      I haven’t had that case before but what about using redirect rules for those medias they are using in third party vendors?


Leave a Reply

Your email address will not be published. Required fields are marked *