Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

TinyMCE converts image paths to relative


For some images, TinyMCE won't allow the scr attribute to be saved with an absolute path. Upon publishing the page, the URL is converted to a relative path. I believe I should be able to prevent this via configuration (relative_urls or convert_urls set to false seem like good guesses), but I'm uncertain as to how I should implement this. I have, however, already successfully gotten rid of TinyMCE's stripping of iFrame, style, fb and other such tags with the help of this blog post (I'm thinking it's probably related):


Any ideas? Thanks in advance!

Apr 08, 2011 17:54


I'm pretty sure that it's not Tiny MCE doing this but rather the permenent link functionality in EPiServer CMS. Links are converted to an internal format regardless if they are absolute and relative and when they are recreated to the site they get the relative path format. I'm not sure if and how this can be changed but I would dig into url rewrite providers.

Apr 11, 2011 8:51

Ok, I'll look into that then. Thanks!

May 05, 2011 19:16

Hi David,

Did you manager to resolve this issue?  We are experiencing the same problem.

We are using the TinyMCE editor to build email templates.   When we insert an absolute URL (event directly into the HTML) it converts it to a relative path as soon as you update the editor.

Many thanks



Feb 17, 2012 13:50
Does anybody have the solution to this?
Dec 27, 2012 14:55


If you want to rewrite all links in a string to it's external representation you could use the RewriteString() function;

public static string RewriteUrlsToFriendly(this string input, bool absoluteUrls)
    if (absoluteUrls)
        // Make url's absolute
        input = Regex.Replace(input, "<img(.*?)src=\"/", "<img$1src=\"" + EPiServer.Configuration.Settings.Instance.SiteUrl.ToString(), RegexOptions.IgnoreCase | RegexOptions.Compiled);
        input = Regex.Replace(input, "<a(.*?)href=\"/", "<a$1href=\"" + EPiServer.Configuration.Settings.Instance.SiteUrl.ToString(), RegexOptions.IgnoreCase | RegexOptions.Compiled);

    var toExternal = new FriendlyHtmlRewriteToExternal(UrlBuilder.RebaseKind.ToRootRelative);

    return toExternal.RewriteString(
        new UrlBuilder(HttpContext.Current.Request.Path),
        new UrlBuilder(HttpContext.Current.Request.RawUrl),

If you don't have a HttpContext I guess you can instantiate empty UrlBuilders and also set the econding to UTF-8.   

Dec 27, 2012 16:06

Thanks Johan.  Your solution works like a charm.

If this doesn't work you may find that TinyMCE is using Relative URLs (default option).  To fix this you can add the following configuration option to your TinyMCE editor:


as described here:

Oh and Happy New Year!
Jan 02, 2013 13:37
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.