Per application servlet mappings for Railo

Railo , Windows 2008 Server Add comments

Another of the big annoyances with Railo is that it won't handle SEO friendly URL's out of the box, you need to get into the application servers servlet mappings to add url filters for each of your SEO URL formats.

e.g. each of these would require a separate servlet mappings url-filter.

mysite.com/index.cfm/something
mysite.com/sub1/index.cfm/something
mysite.com/muraCMS/index.cfm/something

If you are on a shared server then this can be a big problem as you do not have the ability to do this, plus making changes may also break other sites.

Thankfully there is a solution that allows you to apply these url filters on a per site basis, at least for Jetty anyway, I have not tested on any of the other servlet containers such as Tomcat, but the same solution is likely possible.

in your web root you will have a "web-inf" folder which is created automatically and contains your Railo context, inside this folder create a web.xml file and paste in the below contents. 
This will allow the most common SEO URL  "index.cfm/something" to work, I have also included the required filters for MangoBlog. Now you just need to modify this file within each of your sites and add any required url-filters.
The only caveat is that you need to restart your app server in order for the settings to take affect, if you are using the Helicon Zoo module that I blogged about previously then you simply need to recycle your application pool. This can be achieved by editing your web.config as any change to this file forces IIS to recycle the application pool.

 



<?xml version="1.0" encoding="ISO-8859-1"?>


 


<web-app


xmlns="http://java.sun.com/xml/ns/javaee"


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"


metadata-complete="true"


version="2.5"


>


<servlet-mapping>


<servlet-name>CFMLServlet</servlet-name>


<url-pattern>index.cfm/*</url-pattern>


<url-pattern>/post.cfm/*</url-pattern>


<url-pattern>/archives.cfm/*</url-pattern>


<url-pattern>/page.cfm/*</url-pattern>


<url-pattern>/author.cfm/*</url-pattern>


<url-pattern>/feeds.cfm/*</url-pattern>


</servlet-mapping>


</web-app>


 

 

0 responses to “Per application servlet mappings for Railo”

Leave a Reply

Leave this field empty

Powered by Mango Blog. Design and Icons by N.Design Studio