How to setup url rewriting for Wheels with JRUN

CFWheels ColdFusion jrun

Download the binary from Url Rewrite Filter and read the instructions. It is 4 steps. I'll break from the steps after the first one. Step 1: "extract it into your context's directory ie, so that urlrewrite.xml goes into the WEB-INF directory." I download urlrewritefilter-3.2.0.zip and moved the files to

C:\JRun4\servers\cfwheels\cfusion.ear\cfusion.war\WEB-INF
Open urlrewrite.xml, my file was located at
C:\JRun4\servers\cfwheels\cfusion.ear\cfusion.war\WEB-INF\urlrewrite.xml
Search for INSTALLATION, then copy the filter and filter-mapping code from it.

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
logLevel
WARN
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping><br>

Next open your web.xml Mine was located at

C:\JRun4\servers\cfwheels\cfusion.ear\cfusion.war\WEB-INF\web.xml
Search for
CF Monitoring Filter mappings
and paste the copied filter and filter-mapping code above this. You should be below the last
</context-param>
. Restart your jrun instance and test. My test url was
http://cfunited.local/test/status/
(be sure to have the ending
/
) You should be redirected to rewrite-status. This means the url rewriting filter is working. Now to add the CFWheels url rewriting I used the .htaccess file within the CFWheels download for the rules below. Copy the code below and paste it below the
something
and above the
something
in urlrewriting.xml.


The rule is for making CFWheels URLs prettier using URL rewriting.
# http://cfwheels.org/docs/chapter/url-rewriting
# RewriteCond %{REQUEST_URI} !^.<em>/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|sitemap.xml|rewrite.cfm)($|/.</em>$) 
# RewriteRule ^(.*)$ ./rewrite.cfm/$1 
^.<em>/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|sitemap.xml|rewrite.cfm)
^(.</em>)$
/rewrite.cfm/$1
Mike Henke

Written by Mike Henke

Mike Henke (pronounced "hang-kee") is a full-stack developer with 25+ years of experience, evolving from ColdFusion to modern frontend frameworks, AI, and cloud technologies. Based in Omaha, he enjoys time with his wife and three children when not coding.