One of the things I didn't mention in yesterday's entry was that there is an alternative to working with the CGI path_info variable. I didn't bring it up because it is web server dependant which means your code becomes a bit less portable, but at the same time, it does make SES URLs even easier. The other option is URL rewriting. What this means is - we take a URL like so:

and the web server, not our code, actually rewrites it to:

(Note - I have no idea if clownpoop is a real web site or not. Please don't go there. With my luck it will be some obscene site - or worse - pro-Bush. ;)

What's cool about this option is that you do nothing in your code. The web server handles everything. All you have to do is build your links according to the format you want to support, and then tell the web server how to handle it.

If you use Apache, which I do at home, but not for this box, the feature is called mod_rewrite. What's cool is that it does a lot more than just "Translate URL X to Y". You can do conditional translations, for example, based on user agents. Check the documentation for more information.

The option that I use for IIS is ISAPIRewrite. This is a pretty handy little tool, and it is free if you only have one server on your box, or only need to apply one set of rules. The non-free version is 75 dollars, which isn't bad. There are other options out there, and if you are using one, feel free to post one in the comments.

By the way - this is the option I'm using for the new version of CFLib. I didn't want to worry about the URL rewriting in my Model-Glue code, so I'm just letting the server handle it.