Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any good reason to have Sitecore Media url's including tilde?

I could see blog post from 2011 recommending using "-" instead of "~".

What is the best practice to write media URL in Sitecore 6.5 on .NET 4.0/IIS7.5? Should I keep default /~/media/ or follow blog post advice using /-/media/ or while I am there, why not just use /media/?

like image 778
jpkeisala Avatar asked Oct 20 '22 18:10

jpkeisala


1 Answers

I suspect the use of ~ is for legacy reasons. The current recommendation is to use -/media as you point out, but you could use whatever you wanted and it would work. The issue you have just using /media/ is if there is any other item with that as part of the name then it will trigger the media handler, rather than serving up your content for example.

For example, as request for /blah/blah/blah/-/media/images/logo.png will serve up the image correctly, /about/media/news/2013/12/20/sitecore.aspx should in fact serve up a page but will trigger the media handler and return a 404 just using /media/. So if you are going to use something else then make sure it is unique, you may need to enforce it since content editors can be a bit funny about remembering things like this.

Since you are currently using Sitecore 6.5 then I can assume you have existing content. Make sure you leave the existing ~/media trigger to allow your Rich Text fields to continue to work

If you update the Media.MediaLinkPrefix setting on a system that already has some content in a database, Sitecore may not update the values in all Rich Text Editor fields that contain values in the old formats, including inline images and links to media items.

Sitecore Idiosyncrasies: Media URLs

I would probably go ahead and set Media.RequestExtension to an empty string so that image urls are served up with the correct media extension too.

like image 123
jammykam Avatar answered Jan 02 '23 19:01

jammykam