Legacy Knowledge Base
Published Jun. 30, 2025

How to use multiple virtual hosts with the correct friendly URL for Web Content?

Written By

Rita Schaff

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • We have 2 virtual hosts: virtualhost1.com and virtualhost2.com, and also a web content with a link in the content field that points to a page or entity within the Liferay instance.
  • When we have a web content with the friendly URL set on virtualhost1.com, and we display the web content on a page, the friendly URL shows virtualhost1.com/my-friendly-url.
  • The URL does not change if we log in on virtualhost2.com - it only changes if we update the link while we are using virtualhost2.com, then the friendly URL is displayed as virtualhost2.com/my-friendly-url.
  • What can we do to display the correct URL - the domain we are currently on - all the time?

Environment

  • DXP 7.3

Resolution

  • If the template is cached, it means that the cached URL will be served for the links, and the domain / virtual host will not be checked.
  • If you uncheck the Cacheable option in the web content template, the URLs show up as expected.

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base