1

I have the following setup in the cd_link_conf.xml and links are resolving as expected.

<Host Domain="example.com" Port="" Path="/websitefolder/"/>

Another domain will be introduced soon, serving the same website (lets call it example2.com), and links need to resolve relatively to the visitor domain.

For example, if visitor is on example.com links need to point to http://example.com/websitefolder/page1.aspx and if visitor is on example2.com links need to point to http://example2.com/websitefolder/page1.aspx

I have tried the following configuration

<Host Domain="" Port="" Path="/websitefolder/"/>

but it didn't solve my problem, as it didn't produce a relative link, instead I got http://websitefolder/page1.aspx.

<Host Domain="/" Port="" Path="/websitefolder/"/>

produced the same result.

How can I setup linking relative to the visitor domain, with settings for Path active ?

1 Answer 1

2

If you leave the Publications element completely empty, you will get relative linking, as soon as you add a Publication with a Host element, you will get an absolute link to that.

So try this:

<Publications>
    <!--
    <Publication Id="1">
        <Host Domain="example.com" Protocol="http" Port="80" Path="/websitefolder/"/>
    </Publication>
    -->
</Publications>

No this might mean you need to set the path websitefolder in your Publication properties.

3
  • Hi Bart, I can not add websitefolder to the publication properties as this is not an actual folder on the file system and that would case deployment problems. Is it possible to have a Path parameter without having a hardcoded domain? Commented Mar 2, 2015 at 11:48
  • @user3760419 Have you tried the Publication URL, when you choose the Publication Path it will physically go there indeed, but when you use Publication URL, its only part of the URL. Commented Mar 2, 2015 at 12:47
  • Hi Bart, I completely forgot about the url property. This solved my problem. Commented Mar 2, 2015 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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