Search code examples
iis-7sitecoresitecore6

How to enable IIS7 failed request tracing for the Sitecore media library?


I'd like to enable failed request tracing for a group of media items in the Sitecore media library. I initially tried to do this by using a custom setting for the rule so I could use the path:

~/media/mystuff/*

Unfortunately, request tracing doesn't allow a tilda ~ in the path and only allows a single wildcard *. The path also has to be relative to the directory. The tilda is a necessary part of the path, and I want to trace everything in the mystuff folder.

How can I do this?


Solution

  • You can change the media prefix sitecore applies to media library urls. It's stored in web.config in the setting Media.MediaLinkPrefix - we've changed ours to a dash:

    <setting name="Media.MediaLinkPrefix" value="-/media" />
    

    There's a note in the web.config comments about adding a corresponding entry in the <customHandlers> section:

    <handler trigger="-/media/" handler="sitecore_media.ashx" />
    

    To complete the picture, add a url rewrite to map ~ to -, so any indexed media still works.