Monday, August 30, 2010

Change existing context 'ROOT' with your chosen context

I have come across many instance in which developers want to change the existing context 'ROOT'

Steps mentioned below is one easy way of doing it , however I have tried this on versions prior to 6.X . I will update post once I do it successfully on ver 6.X

1. Download tomcat bundle

Using the tomcat bundles saves you from making unwanted changes ,if you start fresh portal installation over tomcat and then try to change the 'ROOT' context , you will have to change many files .

2. Change the name of the existing context ROOT

liferay-portal-5.2.3\tomcat-5.5.27\webapps\ROOT
to
liferay-portal-5.2.3\tomcat-5.5.27\webapps\MyChosenContext

MyChosenContext is the context name you want to use

2b . Change the name of config file
\liferay-portal-5.2.3\tomcat-5.5.27\conf\Catalina\localhost\ROOT.xml
to
\liferay-portal-5.2.3\tomcat-5.5.27\conf\Catalina\localhost\MyChosenContext.xml

3. create a new file named portal-ext.properties which will override portal.properties

location -- liferay-portal-5.2.3\tomcat-5.5.27\webapps\ROOT\WEB-INF\classes\portal-ext.properties

3b. Change portal.ctx property or add in case of new installation
portal.ctx=/MyChosenContext

Snipet of property to be added to portal-ext.properties

## Portal Context
##
#
# Set this property if you deploy the portal to another path besides root.
#
portal.ctx=/