2

When publishing web pages, we would like to point any references to image multimedia components to a different/cookieless domain.

That would mean that we need to somehow prepend a hostname to the image path (for example: prepending http://myImageHost.com to /path/to/image.png).

What is the best practice of achieving this?

  • I think to answer your question directly, when reviewing the below answers consider whether you should need to change code or CMS implementation for what is essentially a presentation/infrastructure concern. – Rob Stevenson-Leggett Jan 13 '16 at 13:21
2

You could probably do this with outbound URL rewrite rules as a configuration only alternative to Vipin's solution.

Create an outbound rule that matches src elements containing /images/ and rewrite to include the domain.

You should be able to do this with the IIS Url Rewrite module or UrlRewriteFilter for Apache/Tomcat

2

We use the structure group properties for doing this and configure this as a name value pair, where in name could be the target like Live or Staging and value will be the domain url for that target.

During publish, you can use these properties in the tbb for transforming into complete urls wherever binaries are referenced.

You can also use Publication properties for configuring this.

0

if its non-dxa solution you can try above solutions and have a look in following very good link

How to render absolute binary path via configuration?

In DXA based solution you can extend the Binary resolver module as per need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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