Category: cfwheels

May 25 2011

Customised URLs for CFEclipse

Posted by AJ Mercer at 4:27 pm - Categories: CFElipse | CFML | cfwheels | Railo

May 9 2011

Friendly URLs for Railo in Cloudbees

Railo was so easy to deploy to the 'cloud' using Cloudbees RUN@Cloud. Mark Drew has written up how to deploy Railo to Cloudbees.

I have been messing around with this just to see what 'cloud' computing is all about and just for fun uploaded CFWheels to ( cloudbees lets you add your own domains). But for a wheels site to look sexy it needs friendly URLs.

This is achievable using Tuckey URL Rewrite Filter which I discovered on Aaron Greenlee's website. Extract to the WEB-INF in the root of your website. Edit the WEB-INF/web.xml and add this before the servet tag


While you are in this file, also add the following with the rest of the CFML mappings. Tomcat does not allow for multiple wildcards


Next Create urlrewrite.xml in WEB-INF. This is what I have based on comments in CFWheels doco

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-// UrlRewrite 3.2//EN" "">
    Configuration file for UrlRewriteFilter
            Allow TomCat to have SES links.
            If our URI ends with one of these extentions we will not perform
            a URL rewrite.
        <condition type="request-uri" operator="notequal">\.(bmp|gif|jpe?g|png|css|js|txt|pdf|doc|xls|xml|cfc|ico|php|asp)$</condition>
            If any URI begins with one of these directories, we will not
            perform a rewrite. Helpful for running your unit tests or
            "blocking" rewrite for some directories.
<condition type="request-uri" operator="notequal">^/$</condition>
       <condition type="request-uri" operator="notequal">^$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/railo-context(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/flex2gateway(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/jrunscripts(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/cfide(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/cfformgateway(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/files(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/images(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/javascripts(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/miscellaneous(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/stylesheets(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/robots.txt(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/sitemap.xml(.*)$</condition>
       <condition type="request-uri" operator="notequal">^(.*)/rewrite.cfm(.*)$</condition>

Now you can start cloudbees for your site and you should be ready for creating freindly URLS. Which for CFWheels means editing config/settings.cfm and adding 

<cfset set(URLRewriting="On")>

And builing links using linkTo(). E.g.

<h1>Page One</h1>
#linkTo(text="Page Two", controller="ses", action="pageTwo")#

Now you are ready to deploy to the cloud and end up with something like this

Posted by AJ Mercer at 4:18 pm - Categories: cfwheels | cloudbees | Railo