Search code examples
sitecoremedia-library

Sitecore Wrong Media File Path


When I add an image through Media Library in RichTextEditor, the image path will be like this,

<img src="~/media/A9DCE5769ED7445CA76F984FAF63A7D7.ashx?la=en" />

However, when I publish page item with this image, the image doesn't appear in Live.

If I manually put slash ("/") in front of path, it works.

<img src="/~/media/A9DCE5769ED7445CA76F984FAF63A7D7.ashx?la=en" />

I know that (~) means root, but sitecore doesn't catch it. Do I have to always put slash manually????

I have checked this https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2012/12/sitecore-idiosyncrasies-media-urls.aspx

But, I'm really looking for the simplest way to fix this issue. (I'm using 7.0)

============ Update ===============

I have changed prefix like "/-/media", but still NOT working!!!


Solution

  • I solved the issue by changing only one line in Web.config file.

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

    But, I don't know why I have to add two slashes. One slash is not working (same as "~/media")

    Is there anybody know why???????