Using Sitecore 8.2.current we're seeing la=en added to a number of our media library (unversioned) image usages (<img src="_.jpg?la=en" />).

In Sitecore version 7.something (7.2?) the recommendation was to override GetMediaUrl to work around Sitecore not having configuration options to cover this.

Is that still the best practice in Sitecore 8.x, or can we make a configuration change to workaround this?

In the master database we only have en in /sitecore/system/Languages.

Verifying with /sitecore/admin/showconfig.aspx, on linkManager we have <add name="sitecore" languageLocation="filePath" languageEmbedding="never" /> (only relevant attributes shown).

In case it mattered, I also added language="en" to the relevant <site> declaration, to no avail.


Update 1:

Thanks to some assistance in the comments, if we use Sitecore.Resources.Media.MediaManager.GetMediaUrl(imageField.MediaItem, mediaUrlOptions); and set mediaUrlOptions to new Sitecore.Resources.Media.MediaUrlOptions() or Sitecore.Resources.Media.MediaUrlOptions.Empty la=en is not added

If we use Sitecore.Links.LinkManager.ExpandDynamicLinks() with a Rich Text field type image sources are expanded, but include the language parameter.

  • So, even with languageEmbedding="never", the language still shows up in the image link? May 19, 2017 at 17:58
  • That's correct. May 19, 2017 at 18:09
  • How are you using the GetMediaUrl() method? Are you passing the MediaUrlOptions as parameter? May 19, 2017 at 18:49
  • Depending upon the usage, it appears he has it using Sitecore.Links.LinkManager.ExpandDynamicLinks() when pulling Rich Text content fields or passing new Sitecore.Resources.Media.MediaUrlOptions(). Both are resulting in language being included. May 19, 2017 at 20:10
  • If you provide the MediaUrlOption() as empty, it should not append the language. Example:` GetMediaUrl(item, MediaUrlOptions.Empty);` May 19, 2017 at 20:14

1 Answer 1


As a workaround, we ended up creating a custom media provider.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sitecore.Data.Items;
using Sitecore.Resources.Media;
using Sc = Sitecore;

namespace Wsb.Sitecore.Media
    public class MediaProvider : Sc.Resources.Media.MediaProvider
        public override string GetMediaUrl(MediaItem item)
            return base.GetMediaUrl(item)
                .Replace("la=en", "")
                .Replace("?&", "?")
                .Replace("??", "?")

        public override string GetMediaUrl(MediaItem item, MediaUrlOptions options)
            return base.GetMediaUrl(item, options)
                .Replace("la=en", "")
                .Replace("?&", "?")
                .Replace("??", "?")


Patch file:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
            <mediaProvider type="Sitecore.Resources.Media.MediaProvider, Sitecore.Kernel">
                <patch:attribute name="type">Wsb.Sitecore.Media.MediaProvider, Wsb.Sitecore.Media</patch:attribute>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.