I use UrlRewrite for pretty much all my apps, and it's great. The
total rule count should be about the same for mod_rewrite and for
UrlRewrite, since they're almost identical in functionality. The
biggest difference I've found is the lack of QSA (query string append)
on UrlRewrite, but that's usually not to much of a hassle.
If you REALLY need the functionality, I wrote a simple little hack to
allow you to fake it with request attributes. Assume you want this
functionality:
RewriteRule ^/([a-z]+).*$ /index.cfm?do=$1 [QSA,L]
That says take a URL like "/view?name=barney" and convert it to
"/index.cfm?do=view&name=barney". The first guess would be to write a
UrlRewrite rule like this:
<rule>
<from>^/([a-z]).*$</from>
<to last="true">/index.cfm?do=$1</to>
</rule>
but that'll trash your query string (yielding "/index.cfm?do=view"
without the name param). So instead, write a rule like this (where
the query string is untouched):
<rule>
<from>^/([a-z]).*$</from>
<set name="qsa.do">$1</set>
<to last="true">/index.cfm</to>
</rule>
That'll yield "/index.cfm?name=barney", plus a request attribute named
"qsa.do" with "view" in it. Then at the top of your app
(Application.cfc or whatever) run this code:
<cfset req = getPageContext().getRequest() />
<cfset enum = req.getAttributeNames() />
<cfloop condition="enum.hasMoreElements()">
<cfset i = enum.nextElement() />
<cfif isSimpleValue(i) AND left(i, 4) EQ "qsa.">
<cfset url[removeChars(i, 1, 4)] = req.getAttribute(i) />
</cfif>
</cfloop>
That simply loops over the request attribute and creates URL variables
for any that start with "qsa.", which is what was set in the second
rule. You won't have the right query string in the CGI scope (it'll
just be "name=barney"), but your URL scope will have everything you
want.
cheers,
barneyb
--
Barney Boisvert
bboi...@gmail.com
http://www.barneyb.com/