Sitecore 6.5 rev. 120247 media urls adding a leading slash

泄露秘密 提交于 2019-12-25 05:14:59

问题


To be able to use Edgecast CDN, we had to write a custom media provider which worked well with before the site was upgraded from 6.5 rev 111230 to 120427. After the upgrade, none of the images showed up on the website. I debugged the code and found a probable cause. In the upgrade following fix was included -

By default, media URLs will now be generated relative to the site root (such as /~/media/images/picture.ashx or /virtualFolder/~/media/picture.ashx) instead of relative to the current page. Such URLs are considered SEO friendly, and also improve caching. (346213, 332285)

This is now adding a leading slash "/" at the beginning of the media urls. So urls are not getting generated as "//mediaserver/abc.jpg". The 'MediaUrlOptions.VirtualFolder" is being set to "/" by default. I want to confirm that this is the issue and also if I can override this in code but I want to find out if this can be controlled from the config file instead of making this change in the code.If this is not the issue then how can I fix this problem?


回答1:


In the interest of providing the answer here:

Remove the slash in the Media.MediaLinkPrefix setting due to Sitecore automatically adding it now: <setting name="Media.MediaLinkPrefix" value="/mediaserver" />

As well as in the following one: <handler trigger="/mediaserver/" handler="sitecore_media.ashx" />

Also, Media API improvements have been made since version 6.5.0 rev. 120427. Now it is possible to elegantly override the MediaProvider class using a web.config setting per reference number 312358 in release notes on the SDN: http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%206/ReleaseNotes/ChangeLog.aspx



来源:https://stackoverflow.com/questions/10823510/sitecore-6-5-rev-120247-media-urls-adding-a-leading-slash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!