OpenCms 8: avoiding “opencms/opencms” in URL


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/startup.sh )
  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 http://opencms.996256.n3.nabble.com/attachment/10246/0/UriRewriteFilter.java
    2. javac -cp /usr/local/apache-tomcat-7.0.41/lib/servlet-api.jar UriRewriteFilter.java
    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






  • Ernie Idpalina

    Hello Admin, i already follow the instruction of this Article about OpenCms URL shortening, i found it hard in the part where i must compile the UriRewriteFilter.java into .class, is that right that I must convert it to .class? I dont know how to do it and Im here for your assistance regarding this matter and barrow your UriRewriteFilter.class so I can use it. Please Help Me. Thank You.

    • Andreas Christ

      4. February 2014 von Andreas Christ

      Hi Ernie,

      it’s not complicated. You have received the “UrlRewriteFilter.java”? Ok. Next you have to compile it, so go to your shell and enter the second command (javac -cp /usr/local/apache-tomcat-7.0.41/lib/servlet-api.jar UriRewriteFilter.java) – this will produce the UrlRewriteFilter.class.
      The next step is to copy that class into a specific OpenCms folder; this can be done by step 3 (mkdir) and 4 (copy).
      I assume, that you have problems with one of these steps? Please tell me more details, at which step you encounter some difficulties.

  • Ernie Idpalina

    Hello Admin,
    Actually im using XAMPP for windows, i have here Tomcat directory C:\xampp\tomcat\ , my problem is how can i enter such cmd command like that to turn UriReWriteFilter.java into .class file? Sorry im a beginner in Tomcat so please help me.

    • Andreas Christ

      4. February 2014 von Andreas Christ

      Hi Ernie,

      XAMPP is not so very good, since it is a package for PHP development, but OpenCms itself is Java-based…

      First, you need a Java Development Kit (JDK) for your platform (Windows), e.g.:

      If you have installed the JDK and see no error while starting “java -version” you’ll be able to compile the *.java source code into a runnable *.class file (as I described in the article or my last post). Just start a command line tool in Windows (Start –> execute program –> cmd) and go to the *.java file. Please read some tutorials about Java first (http://docs.oracle.com/javase/tutorial/). You have to learn: what ist Java, how can Java be compiled, how can a Java program be executed etc.


  • Clint Alexander

    24. May 2014 von Clint Alexander

    I used this tutorial on opencms 9 and I was convinced it worked until i discovered that the workplace produced errors when you go to the Administration View. When you click Project Management,Publish Queue, Account Management, Module Management,Search Management,Scheduled Jobs, Site Management you get this error:

    A system error reading a resource occurred!

    Server error 404

    Not Found

    The requested resource “/system/workplace/views/admin/admin-main.jsp” was not found on the server.


    Probably you used an outdated link or an old bookmark.

    If you followed a link on our site, please try it again in a few minutes.

    I have been trying to resolve this. The file do exist in the location specified. Any suggestions?


Your email address will not be published. Required fields are marked *