Beliebte Suchanfragen

Cloud Native



Agile Methoden



OpenCms 8: avoiding “opencms/opencms” in URL

6.8.2013 | 1 minutes of reading time

A normal local installation of OpenCms in a Tomcat container yields URLs like http://localhost:8080/opencms/opencms/welcome/  etc. If OpenCms is the only application on Tomcat, there’s no need for the first ‘opencms’. And if the second will be automatically filtered out, you can use OpenCms with URLs like this: http://localhost:8080/welcome/  .

There’s no need to use an additional Apache WebServer (httpd), just plain Tomcat and a Java class and some tricks.

  1. Before installation of OpenCms rename original opencms.war file to ROOT.war
  2. remove default ROOT folder in your $CATALINA_HOME/webapps (e.g. /usr/local/apache-tomcat-7.0.41/webapps)
  3. install MySQL server if needed
  4. start Tomcat (e.g. with /usr/local/apache-tomcat-7.0.41/bin/ )
  5. start OpenCms installation in your browser (localhost:8080/setup )
  6. next… next… finish (default values should be ok for your local installation)
  7. see welcome page (with one remaining ‘opencms’ in URL): http://localhost:8080/opencms/welcome/
  8. in web.xml (in ROOT/WEB-INF folder) add the following code:
  9. and alter in that same web.xml file the following line from



    (‘/opencms’ removed)

  10. now download the UriRewriteFilter Java class into your home directory, compile it and deploy it to OpenCms as follows:
    1. wget
    2. javac -cp /usr/local/apache-tomcat-7.0.41/lib/servlet-api.jar
    3. mkdir -p /usr/local/apache-tomcat-7.0.41/webapps/ROOT/WEB-INF/classes/com/dcampus/opencms/web
    4. cp UriRewriteFilter*.class /usr/local/apache-tomcat-7.0.41/webapps/ROOT/WEB-INF/classes/com/dcampus/opencms/web
  11. restart Tomcat
  12. go to URL-shortened welcome page: http://localhost:8080/welcome



share post




More articles in this subject area

Discover exciting further topics and let the codecentric world inspire you.


Gemeinsam bessere Projekte umsetzen.

Wir helfen deinem Unternehmen.

Du stehst vor einer großen IT-Herausforderung? Wir sorgen für eine maßgeschneiderte Unterstützung. Informiere dich jetzt.

Hilf uns, noch besser zu werden.

Wir sind immer auf der Suche nach neuen Talenten. Auch für dich ist die passende Stelle dabei.