Search code examples
tomcaturl-rewritingrailolucee

Tomcat SES Friendly URLs Beneath Root (Lucee/Railo)


I have an Tomcat/Lucee (Railo) setup and I'm trying to devise a way to get friendly URLs to work beneath the root. Currently the Tomcat servlet-mapping is configured as:

<servlet-mapping>
<url-pattern>/index.cfml/*</url-pattern>
</servlet-mapping>

But it will only work if the index.cfm is in the root of the website. I'd like a single configuration method so that I can use the following without having to make a specific servlet-mapping entry for each one:

/subDirectory1/index.cfm/main
/subDirectory2/index.cfm/main

Is this possible? Perhaps using UrlRewriteFilter (tuckey)?


Solution

  • Tomcat does not allow for multiple wildcards in a servlet-mapping url-pattern. Adobe created their own fork of Tomcat to allow for this use case.

    This may not be the answer you want, but without moving the index.cfm to the root and using the rewrite module to rewrite /subDirectory1/index.cfm/main to /index.cfm/subDirectory1/main (or some variant) and adjusting your code to suit, you will not be able to get away without editing your configuration for each subdirectory.