I've been using ISAPI_Rewrite on this machine for some time now to support friendly urls at the ColdFusion Cookbook and it has worked well. (By the way, notice how many entries we have at the cookbook now!) I wanted to refresh the beta copy of CFLib2006 on here to get some folks testing, and knew I had to do something with ISAPI_Rewrite. While it is free for one box, you can't apply rules just for one virtual server unless you pay for the commercial version.
To be fair, the commercial version is only 69 dollars, but as a cheap person, I couldn't abide by that. I did some googling and came across another ColdFusion user who recommended IIRF, Ionic's ISAPI Rewrite Filter. This took all of ten minutes to setup. I had both the beta version of CFLib running it's own rules and the cookbook as well. Best of all - you can't beat the price - free.
I can definitely recommend it for folks using IIS and desiring nice URLs. Of course, if you have Apache, it's built-in. Maybe Microsoft will add it to IIS one day, like when they add virtual servers for XP Pro, or multiple versions of IE on one box. (Keep repeating - The Mac is coming... The Mac is coming...)
Archived Comments
thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you!
and thank you! :)
Shoot. I forgot to be clear - and fair to my readers.
I've run this software now for 60 minutes. So... technically I haven't really done a lot with it. But it was super quick and easy to setup and so far I love it.
Check out what I'm doing with Fusion Authority. An url like this:
http://www.fusionauthority....
is actually going to a CF template without the file being written. I've been meaning to write the technique up on Blog of Fusion but if you want I can tell you exactly how I do it. All free and smooth without any plugin or url rewriter.
Ray - thanks - I've been messing around with ISAPI_Rewrite as well - will have to check out this new version - I guess my only concern is how does it handle a load.
Michael - please share how you are using CF to do this! :)
Michael - I'd be interested. I have a project in the works that could use this.
In my experience the only way to perform url rewrites w/o apache or iis isapi plugins is either having a missing template handler within CF and handling all bad CFM requests, or pointing the IIS 404 custom page to a location, a CF page, instead of a file. The first one will only work if IIS sends the request to the CF dll... the second one works perfectly, BUT, it's extremely heavy and I wouldn't recommend it.
If there are other options, I'd love to know ... I've been playing with ISAPI_Rewrite and it works great... I will also test IIRF shortly and post results.
Best,
~Rob
We can vouch for the Ionics ISAPI filter.. its the windows standard for FarCry CMS friendly URL technology.
http://docs.farcrycms.org:8...
You can run multiple version of IE. http://www.quirksmode.org/b...
Brian, I'm sorry, but that is not good enough. You should not have to resort to hacks to do something so simple. I understand that the need for multiple browser versions is a limited need amongst MS's customers, but it is a very important need for us and it should addressed "officially".
That will never happen so it has to be good enough. It works and others have done all the dirty work for you already. Create a folder, copy files in and done.
If Microsoft really wanted to help up they could just adhere to the web standards and we wouldn't need to multiple versions of IE for testing. To me it seems like it would be much easier to tweak out a few objects to get the box model and like working properly than work on multiple versions.
Perfect adherance to standards would not eliminate the need to test older platforms. New standards working perfectly in new browsers does not solve the problem of solving backwards compatibility with the 'old' standards of old browsers. As long as technologies continue to improve and upgrades are optional for a consumer, we will always need to test.
If you are going to bash Microsoft, bash them on the right stuff.
Not sure you could call what I wrote "bashing" Microsoft.
Wow, that was easy to use! :-)
That's a big help for all of my non-CF redirects. Thanks for passing along the tip.
FYI, rewrite URLs (right side of the rule) that contain # signs don't seem to be working and are not documented.
I've tried to escape them, but it doesn't appear that they are evaluated.
Doesn't work:
RewriteRule ^/cim(/?)$ /about/business/index.html#cim
This does:
RewriteRule ^/cim(/?)$ /about/business/index.html
I've emailed the author and hope to hear back. Other than that, it's working REALLY well. :-)
A follow up comment to my previous statement...
Dino (the IIRF author) mailed me back promptly with an answer. The #PAGEID url suffix is a browser side feature that can't be controlled by the server through rewrites. (Now THAT makes sense)
As a follow up, he has published the IIRF 1.2.4 update which now does browser-side redirection, which will allow for ID url suffixes or forwarding to another server if needed.
The 1.2.4 update is available here:
http://cheeso.members.winis...
Hey, glad all y'all like the filter.
The current version is 1.2.6 (2006 June 5). Try it, should find this to be much more stable and higher quality than 1.2.3 and prior versions.
IIRF gets minor updates from time to time. There is no mailing list set up yet to get notified of these updates.
ps, as Dan Sorenson said, the home page for IIRF is http://cheeso.members.winis...
Hi I'm trying to use ionic with 2 conditional rules:
RewriteCond %{HTTP_HOST} ^scholarschoicetoys$
RewriteRule /(.*).aspx$ /$1.aspx?iZoneUID=1
RewriteCond %{HTTP_HOST} ^scholarschoice$
RewriteRule /(.*).aspx$ /$1.aspx?iZoneUID=2
But the first rule seems to be the only one that's ever checked! If I reverse the order then the other gets checked, but the second never evaluates.
Am I misunderstanding, or just stupid?
I was just wondering, has anyone tried out IIRF with Coldfusion 7? I've had a problem with ISAPI Rewrite not returning the HTTP_X_REWRITE_URL variable it used to under Coldfusion 5 and wanted to know if IIRF returns similar information about the original URL.
Cheers
I use it in CFMX7, but I don't know if that CGI var is there or not.
Dino got back to me earlier stating that it hasn't but if I wanted it to he'll add it in.
So it probably will by the next version :)
Dino has been amazingly responsive. :-) It wouldn't hurt to see if he has a 'wish list' as well. His IIRF plugin and supurb support has allowed me to get along with IIS much better than I thought I would.
To Chris Cauchi -
The problem is that either of your RewriteRules, when satisfied, produce a result that will not satisfy the other.
Whatever.aspx?iZoneUID=1 does not match a pattern like
/(.*).aspx$
If you want to apply additional rewrites after the first rule, then you may need to generalize the pattern to be something like
/(.*).aspx(\?(.+))*$
which will match URLs with query params following the .aspx, as well as bare URLs ending in .aspx.
This is not specific to IIRF, though, it is a regular expression thing.
IIRF v1.2.8 is available here:
http://cheeso.members.winis...
It sets the HTTP_X_REWRITE_URL server variable to the original URL, if you apply the [U] modifier flag to the RewriteRule. I think this is what people want. Check the readme for more details.
There are also a bunch of other modifier flags now supported.
What is required on the developer's side to implement this? I'm guessing that you've got to have some sort of access on the system level to install this filter? Or is it as easy as installing a "text file" in web root like you can do with Apache and mod_rewrite?
You have to have admin access to install it, but once you point it to a file, you could then edit it like a normal developer. (if that makes sense)
It's a standard ISAPI Filter that must be installed in IIS with the MMC. Takes 30 seconds. After that it filters incoming requests using a simple plain text configuration file called: IsapiRewrite4.ini
I've been very happy with it. :-)
What's happen with one thousand or more of (simple) rules? What about response time?
No idea. I've used, at most, 10 or so rules. I would think 1k rules would be a bad idea in general, even if performance wasn't hurt.
Unless you specify that a rule is the 'last one', they will ALL be processed for EVERY file requested. Images, css, text, etc. Its better to have fewer rules, more specific rules and stop actions after rules that need it.
On the whole, I prefer to use onMissingTemplate() for my url rewriting. If I may plug, I have an article that covers it in the latest FAQU and I'm using it live on jobs.houseoffusion.com and www.fusionauthority.com.
There are few places where I'd even think of using an ISAPI and all of those places are on clients using CF7 or earlier.
As much as I love onMissingTemplate, it is missing (heh) some important functionality. For example, I can't handle a request for /FOO where foo is a folder that doesn't exist. You _have_ to request /something/something.cfm in order for it to fire.
Now the fact that we have it is nice - but it does not remove the need for something like a proper url rewriter.
For that I use a small mod to the IIS 404 handler to accept the missing dir and then return a value as if it existed.
Unfortunately, this is a webserver issue, not a CF one. An implicit call to a file (default file) in IIS always checks for the files existence before sending it to CF. If the call is explicit then the request is sent without any check for the files existence and onMissingTemplate() will handle it. /foo/index.cfm will work while /foo will not.
Oh I agree this is a web server issue. I'm not blaming CF for not being able to handle it - but my point is - I don't think onMissingTemplate removes the need for URL rewriting. There are cases where doing it server side makes more sense.
Hi. Ray, might I ask what you did to "mod the iis 404 handler"? I'm using isapi rewrite and have a rule that produces good output, but 404's in the browser. I assume it's IIS related at this point. Any ideas?
Thanks.
I'd better add that my goal is to accept http://host/about_us, for example, and rewrite as http://host/content.cfm/about_us.
Thanks.
Did you mean Michael?
If you have a question on IIRF, you can ask on the discussion forums on http://www.codeplex.com/IIRF .
Yes, sorry, I intended that for Michael. I presume that's Dino. My question isn't regarding IIRF. The rule I wrote tests fine in the testing utility, though IIS throws a 404.
Dino, your mention of modding the IIS handler to accept a missing directory is what I would like more info on and believe could help me out. This was one of the more promising "leads" I found while googling, which is why I asked here. Thanks.
Did anyone ever get an answer as to whether or not the variable HTTP_X_REWRITE_URL is availble in the CF world? I've checked the CGI and Server variables after redirecting to a page and cannot find this variable anywhere.
When you cfdump cgi, it is, if I remember right, a hard coded list of keys. Because each web server can set it's own CGI vars, you may not see everything in a dump. You can also do cgi.ray and get an empty string. So CGI is a bit special. Try outputting cgi.http_x_rewrite_url and see if there is a value.
Yeap, already tried that and it doesn't appear to be adding it to the cgi scope. I checked my IIS logs and the [U] option is definitely keeping the original URL in the logs, it's just a mystery in CF where it sets that special var to be able to reference it again.
I'm going to post on the forum for the author of the IIRF tool and see if I get a response there.
yes, HTTP_X_REWRITE_URL is supported in IIRF. It's still available at http://iirf.codeplex.com. There's a discussion forum there, too. That's the best place to ask questions.
Could you share the iirf.ini file you are using for http://www.coldfusioncookbo...
Here ya go.
RewriteRule /categories /\?event=categories
RewriteRule /faq /\?event=faq
RewriteRule /submit /\?event=submitform
RewriteRule /category/([0-9]+)/.* /\?event=showentries&id=$1
RewriteRule /entry/([0-9]+)/.* /\?event=showentry&id=$1&categoryid=$2
RewriteRule /search /\?event=search
RewriteRule /rss /\?event=rss
RewriteRule /downloadwithcomments /\?event=download&comments=true
RewriteRule /download /\?event=download
RewriteRule /allentries /\?event=allentries