vipergtsrz
vipergtsrz

Reputation: 1061

Sitecore sc:image tag produces a URL that gives a 404

I'm using an sc:image field renderer tag in Sitecore and when that field gets generated it produces this tag in the front end:

<img src="/~/media/81907AC0172D4B93B5DF05E47B625F09.png" class="homepage_circle_icons" alt="Attract Customers" width="66" height="60">

In the url, it has .png at the end. On my localhost, this works perfectly, but when I deploy to our dev server, this URL comes up as a 404 because the physical png file isn't found.

When I try to view the image in a browser and take off the ".png" extension, it loads just fine.

I am using the exact same code on localhost as dev, so it has to be an IIS server setting of some kind, right? I don't think it has anything to do with the MIME types because those settings are the same as well.

I know I could override the LinkProvider and GetMediaUrl functionality, but I want to get to the root cause as to why my dev server is trying to find the png file in the physical file system instead of triggering Sitecore's pipelines to find it.

Any thoughts?

Upvotes: 1

Views: 412

Answers (1)

Ian Graham
Ian Graham

Reputation: 3216

Check the media.requestextension setting in the web.config it might be different in your other environment. More info here.

http://sitecoreblog.patelyogesh.in/2013/09/sitecore-media-url-remove-ashx-extension.html

Upvotes: 4

Related Questions