Change root context to custom context

Issue

  • How to change the portal context from ROOT to something else?
  • Can I append "xxx" to all the portal URL?

Environment

  • Liferay DXP 7.4
  • Liferay DXP 7.3
  • Liferay DXP 7.2
  • Liferay DXP 7.1
  • Liferay Portal 6.2
  • JBoss EAP 7.1 / Tomcat 9.0

Resolution

  • For JBoss, the following is an example of how to change the default root context to custom 'myportal' context.
    1. In {JBOSS_HOME}/standalone/deployments, rename ROOT.war and ROOT.war.deployed to myportal.war and myportal.war.deployed.
    2. Modify WEB-INF/jboss-web.xml from
      <context-root>/</context-root>
      to
      <context-root>myportal</context-root>
    3. Clear up Jboss 'tmp' folder
    4. Restart the server
  • For Tomcat, the following is an example of how to change the default root context to custom 'myportal' context.
    1. Update the ROOT folder name (under {LIFERAY_HOME}/tomcat_home/webapps/ROOT) to 'myportal'.
    2. Update the ROOT.xml file name (under {LIFERAY_HOME}/tomcat_home/conf/Catalina/localhost/) to 'myportal.xml'.
    3. Update the common.loader property in the catalina.properties file name (under {LIFERAY_HOME}/tomcat_home/conf/) from:
      common.loader=“${catalina.home}/webapps/ROOT/WEB-INF/lib/support-tomcat.jar”
      to
      common.loader=“${catalina.home}/webapps/myportal/WEB-INF/lib/support-tomcat.jar”
    4. Clear temp and work directories under TOMCAT_HOME.
    5. Restart the server.
  • The original portal URL is "localhost:8080/". After changing the portal context, the portal URL will be changed to "localhost:8080/myportal/".
  • It is important to also change other paths originally pointing to the ROOT context, such as Patching Tool's configuration file (default.properties):
    • war.path
    • global.lib.path

Additional Information

  • Above configuration are Application Server settings. Further recommendations need to be discussed with the corresponding Application Server Vendor.
Was this article helpful?
3 out of 4 found this helpful