Finally, a framework for the rest of us!

CFWheels is an open source CFML (ColdFusion Markup Language) framework inspired by Ruby on Rails that provides fast application development, a great organization system for your code, and is just plain fun to use.

One of our biggest goals is for you to be able to get up and running with CFWheels quickly. We want for you to be able to learn it as rapidly as it is to write applications with it.

Get Started    

URL Rewriting

Making URLs prettier using URL rewriting.

URL rewriting is a completely optional feature of Wheels, and all it does is get rid of the index.cfm part of the URL.

For example, with no URL rewriting, a URL in your application could look like this:


After turning on URL rewriting, it would look like this:


Combine this with the routing functionality of Wheels, and you get the capability of creating some really human-friendly (easier to remember, say over the phone, etc.) and search engine friendly (easier to crawl, higher PageRank, etc.) URLs.

Once you have uncommented the rewrite rules (found in either .htaccess, web.config or IsapiRewrite4.ini), Wheels will try and determine if your web server is capable of rewriting URLs and turn it on for you automatically. Depending on what web server you have and what folder you run Wheels from, you may need to tweak things a little though. Follow these instructions below for details on how to set up your web server and customize the rewrite rules when necessary.

Instructions for Apache

On most Apache setups, you don't have to do anything at all to get URL rewriting to work. Just uncomment the rewrite rules in the .htaccess file and Apache will pick up and use them automatically on server start-up.

There are some exceptions though...

If you have installed Apache yourself you may need to turn on the rewrite module and/or change the security settings before URL rewriting will work:

  • Check that the Apache rewrite_module has been loaded by ensuring there are no pound signs before the line that says LoadModule rewrite_module modules/ in the httpd.conf file.
  • Make sure that Apache has permission to load the rewrite rules from the .htaccess file. This is done by setting AllowOverride to All under the Directory section corresponding to the website you plan on using Wheels on (still inside the httpd.conf file).

If you have an older version of Apache and you're trying to run your Wheels site in a sub folder of an existing site you may need to hard code the name of this folder in your rewrite rules.

  • Change the last line of the .htaccess file to the following: RewriteRule ^(.*)$ /sub_folder_name_goes_here/rewrite.cfm/$1 [L]. Don't forget to change sub_folder_name_goes_here to the actual folder name first of course.

Instructions for IIS 7

Similar to Apache, IIS 7 will pick up the rewrite rules from a file located in the Wheels installation. In the case of IIS 7, the rules are picked up from the web.config file. (Don't forget to uncomment the XML block containing the rewrite rules in that file first.)

This requires that the URL Rewrite Module is installed. It's an IIS extension from Microsoft that you can download for free.

Instructions for IIS 6

Unfortunately, there is no built-in URL rewriting mechanism in IIS 6, so getting Wheels working with pretty URLs is a little more complicated than with Apache and IIS 7 (which often comes with the official "URL Rewrite Module" installed by default). Here's what you need to do:

  • Download Ionic's ISAPI Rewrite Filter. NOTE: the version must be v1.2.16 or later.
  • Unzip the file, get the IsapiRewrite4.dll file from the lib folder and put it in the root of your website. (It needs to be in the same folder as theIsapiRewrite4.ini file.)
  • To enable the rewrite filter in IIS 6, click on Properties for your website, then go to the ISAPI Filters tab and click the Add... button.
  • Type in anything you want as the Filter Name and point the Executable to the IsapiRewrite4.dll file.
  • Uncomment the rewrite rules in the IsapiRewrite4.ini file.

NOTE: Make sure you have "Verify that file exists" disabled for your site.

  • Right click your website and select Properties.
  • Click Home Directory tab.
  • Click the Configuration button.
  • Under the Wildcard application mapping section, double-click path for the jrun_iis6_wildcard.dll.
  • Uncheck Verify that file exists.
  • Click OK until all property screens are closed.

Instructions for UrlRewriteFilter

UrlRewriteFilter (commonly referred to as Tuckey) is a Java web filter for compliant web application servers such as Tomcat, Jetty, Resin and JBoss. Unfortunately UrlRewriteFilter depends on XML with its extremely strict syntax.

  • First follow the (install instructions on the UrlRewriteFilter website).
  • Append the servlet-mapping markup to the end of the <filter mapping> element in your WEB-INF/web.xml
  • Add the pretty urls rule markup to the <urlrewrite> element to your WEB-INF/urlrewrite.xml configuration.
  • Restart the web application server.

Servlet-Mapping markup


Example markup with UrlRewriteFilter and Wheels pretty URLs for WEB-INF/web.xml.


Pretty URLs Rule markup

<rule enabled="true">
    <name>CFWheels pretty URLs</name>
    <condition type="request-uri" operator="notequal">^/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|lucee|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)</condition>
    <to type="passthrough">/rewrite.cfm/$1</to>

A complete barebones WEB-INF/urlrewrite.xml configuration example with pretty URLs.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite
    PUBLIC "-// UrlRewrite 4.0//EN"

  <rule enabled="true">
    <name>CFWheels pretty URLs</name>
    <condition type="request-uri" operator="notequal">^/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|lucee|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)</condition>
    <to type="passthrough">/rewrite.cfm/$1</to>

Instructions for Commandbox 2.x

Wheels runs just fine using CommandBox; In your wheels webroot, when starting the commandBox local server, add the --rewritesEnable argument, so your entire string looks like:

$box server start --rewritesEnable

Lastly, you may need to add


to your config/settings.cfm file, to allow urlFor() to pickup the appropriate rule.

Deleting Unnecessary Files

The sole purpose of the .htaccess (for Apache), web.config (for IIS 7), and IsapiRewrite4.ini (for IIS 6) files is to make it possible to use URL rewriting. You can delete the files you don't need if you want - just bear in mind they might be useful to others if you have an application with more than one developer.

Don't Forget to Restart

If you need to make changes to get URL rewriting to work, it's important to remember to always restart the web server and the ColdFusion server to make sure the changes are picked up by Wheels.

If you don't have access to restart services on your server, you can issue a reload=true request. It's often enough.

URL Rewriting

Making URLs prettier using URL rewriting.