Multitenancy and referencing media?

Topics: Administration, General
Sep 16, 2011 at 2:48 PM

In a multitnenant deployment of Orchard, request are routed to the correct tenant by the hostname in the http request. However, when requesting resources from the Media folder, the tenant name must also appear in the URL.

Say I have two tenants:

  • HostA -
  • HostB -

I create default content that I want to display in both tenant sites. The content references branded images stored in each tenant's Media folder. Now, I must fixup the links to the images when I move the content from HostA to HostB because the Image in the content would look something like:

<img src="/Media/HostA/BrandedImage.png />

If I use import/export to move my content from HostA to HostB, I now have an additional manual step to fix up the img src attributes since the tenant name is in the media path as well as the host name.

I simplified my example, but in my reality I have dozens of pages that only differ in the images displayed. I want to simply import my content each time I set up a new tenant and upload custom images for each tenant and have it displayed correctly. Is there a way to avoid this manual step of editing the img src paths?

Sep 16, 2011 at 4:06 PM

For the moment no, unfortunately.

Sep 16, 2011 at 4:39 PM

so, what I am doing is Exporting all my content to an XML file. Editing the XML file and doing a global search and replace to fix up all my source links. It is still a manual step, but not too bad.