Legacy Knowledge Base
Published Jun. 30, 2025

Accessing a site page from a different virtual host

Written By

Adam Kollar

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

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

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

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

Issue

  • When there are 2 or more sites for example Site1 and Site2.
    Site1 is mapped to the friendly URL "site1" and Site2 is mapped to "site2".
    They both have virtual hosts site1.com and site2.com.

  • The sites can be reached through localhost:8080/web/site1 or localhost:8080/web/site2 as well as site1.com and site2.com.

  • Site1 can also be reached through site2.com/web/site1 and Site1 can be reached the same way on site2.com/web/site1.

Environment

  • DXP 7.4

Resolution

  • To enforce access restrictions on websites accessed from virtual hosts divergent from their designated assignments, you can employ Apache's redirection capabilities. 
    Apache serves as a front-facing web server interfacing with Liferay's Tomcat infrastructure, facilitating the implementation of such access control measures.
  • This can also be achieved by utilizing Nginx rewrite rule functionality.
  • Please see the following example:
    RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/group/*'" 
    RewriteRule ^/web/group-key https://www.group-domain.com [R,L]
Did this article resolve your issue ?

Legacy Knowledge Base