Skip to main content
2 of 3
added 892 characters in body

DD4T RTF images pre-pended with incorrect path

We are using DD4T on SDL Tridion 2011 SP1 HR1. When presenting images from within a RTF we note that the root path is added twice to the image path/filename.

We have configured the web app under a virtual path /vpath/ as read from the webserver variables HttpContext.Current.Request.ApplicationPath.

Images are being presented to the deployed environment as /vpath/vpath/images/image-name.jpg - any ideas if we're missing a configuration to indicate the path prefix is not required?

We originally setup the publication with the /vpath part in the URL in the Publications Settings Path and later the requirement (IT team) was to setup the application to run under a virtual directory.

We'd initially thought we could reuse a web.config setting we have to indicate that the application runs under a virtual directory (for other functional requirements)

<add key="VirtualDir" value="vpath" />

and just update the method to:

    public static string AdjustUrlToContext(string url)
    {
        if (!string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["VirtualDir"]) 
            return url;

        return HttpContext.Current.Request.ApplicationPath + url;
    }

But we also need to consider if we create another publication and the publication setting does not include the virtual path.

Any ideas?