Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL issue for Media Library Item URL in Sitecore Rich Text Editor

We are using Sitecore 6.2 and required to use SSL on the Sitecore admin site.

Everything works perfectly except that when saving the content in the Rich Text editor (clicking ACCEPT button), all URLs to the media library items will be added with "https://....(our domain address)". For example,

"~/media/70E900F781E24A66915FA97E283C148E"

to

"https://www.mywebsite.com/~/media/70E900F781E24A66915FA97E283C148E"

The workaround is to go to HTML editor and manually remove the "https://..." part. If we remove the SSL, then the addition won't happen and it'll work fine.

I'm assuming having the Sitecore admin site on SSL is not rare so I wonder if there is a way to deal with this. Thanks!

like image 543
Exodues Avatar asked Dec 07 '25 20:12

Exodues


1 Answers

You could probably de-compile and tweak the out-of-the-box LinkProvider class and change the ExpandDynamicLinks() method to replace https:// with http://

The class is defined in the web.config in this setting:

<linkManager defaultProvider="sitecore">
  <providers>
    <clear />
    <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="true" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" shortenUrls="true" useDisplayName="false" />
  </providers>
</linkManager>

You could re-create it as a custom provider and set the defaultProvider to your custom class:

<linkManager defaultProvider="custom">
  <providers>
    <clear />
    <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="true" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" shortenUrls="true" useDisplayName="false" />
    <add name="custom" type="CustomUtility.LinkProvider, CustomUtility" addAspxExtension="true" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" shortenUrls="true" useDisplayName="false" />
  </providers>
</linkManager>

If you don't have a de-compiler, ILSpy is a free one.

like image 191
Mark Ursino Avatar answered Dec 12 '25 12:12

Mark Ursino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!