Rip's Domain

CFWheels: URL Rewriting in a subfolder using IIS

Posted in CFWheels by rip747 on February 23, 2009

If you check the official documentation on URLRewriting in CFWheels, it’s said that Wheels doesn’t support using URL Rewriting if Wheels is in a subfolder, however there are people out there doing it. I’ve been trying to figure out how to do this by scowering the forums and everything, but just couldn’t find a diffinitive example on how to do it. So as a benefit to myself and others, here’s how to do it under IIS.

Imagine (if you will) we have a website with the following setup:

Directory: c:\inetpub\wwwroot\example

and we want Wheels to run in the subfolder /myapp/survey. So the full url to our Wheels app would be:

The first step is to right click on your website in IIS and click “properties“.
Then in the ISAPI Filters tab, you are going to install the IsapiRewrite4.dll as a filter. So click “Add” and enter in a name for the filter (call it Rewrite for good measure) and browse to the IsapiRewrite4.dll in your application directory. The path should be (if using this tutorial as a guide):


Click “ok” and then “ok” again. IIS is now setup.

Now it’s time to edit the IsapiRewrite4.ini to reflect the path. Open up the IsapiRewrite4.ini in our application folder, it should look like this:

RewriteRule ^(/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets).*)$ $1 [L,I]
RewriteRule ^(/.+/.+/.*\?.+\..*)$ /rewrite.cfm/$1
RewriteRule ^(/[^.]*)$ /rewrite.cfm/$1

Now the easy part, edit the rules in the ini file to reflect our application path. Following our example, your IsapiRewrite4.ini should look like this:

RewriteRule ^/myapp/survey(/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets).*)$ /myapp/survey/$1 [L,I]
RewriteRule ^/myapp/survey(/.+/.+/.*\?.+\..*)$ /myapp/survey/rewrite.cfm/$1
RewriteRule ^/myapp/survey(/[^.]*)$ /myapp/survey/rewrite.cfm/$1

Notice that we added “/myapp/survey” to the beginning of every rule and just before the “/rewrite.cfm” in rules 2 and 3.

Now the only thing left to do is reload our web application in IIS to reflect the changes. If you’re using IIS 6.1 (Windows 2003), this is really easy. Just expand the “Application Pools” folder in the IIS Administrator and find the Application Pool that corresponds to your Wheels application (hint: right click on your website, select “properties”, and click the “Home Directory” tab. The Application Pool that is assign to your website will be list here). Now just right click on the Application Pool and select “Recycle

That’s it! Now open a browser and point it to:

and you should get the Wheels Congratulations screen. Go luck and leave any comments, corrections or flames below.

Fork CFWheels

Posted in CFWheels, ColdFusion by rip747 on February 14, 2009

That’s right, FORK IT!!!!

In an effort to get more people contributing and involved with the project (also because I’m migrating all my projects to git) I’ve created a github / Google Code bridge for CFWheels! I’ll be rebasing with Google Code everyday I’m at work to keep the two reposiories synced.

So now’s the time to get off your ass, open up a github account and start coding. Cause, you know, summers coming and us programmers don’t do well in the sun.

Come on, Per needs our support so go Fork Yourself!

Query taking too long? Could be a null.

Posted in ColdFusion, MSSQL, SQL by rip747 on February 5, 2009

I was smacking my head against the wall trying to figure out why in the world a scheduled task I wrote was timing out on my production server, but not on my development server.

I started by looking at the database first since I know that that is the place that 99% of performance tuning could be done. I fired up Query Analyzer and popped in the SQL statement and began combing through the tables and views that made up the query.

To make a long story short (too late), I noticed that in one view I was returning a count aggregate and in my development database every row returned a value, but on my production database there was a row that was returning a null. I patched the problem with a quick isnull() and reran the query again. IT WORKED!!!!

The lessons I learned, double check your work, always account for nulls on joins and aggregates and never write business logic views at 4 in the morning.

jQuery: Quick, cute, double form submission prevention

Posted in Jquery by rip747 on February 3, 2009

var $that = $(this);
$that.find(“input[type=’image’],input[type=’submit’]”).attr(“disabled”, “true”);

what i like about this approach more than anything is that it handles both image button and regular form buttons