Plugins - Request Routing
Add to favoritesPlugin that allows you to define routing requirements that test methods/properties of the request object such as subdomain, domain, port. You can test them either against a value or with a Regexp (assuming the method returns a string).
In routes.rb you can specify use the :requirements hash with request properties:
map.connect '', :controller => 'main', :requirements => { :subdomain => 'www' }
You can also, of course, use the requirements hash in map.with_options calls.
The allowed properties are:
:subdomain (only checks the first subdomain)
:domain
:method (a symbol)
:port (a number)
:remote_ip
:content_type (content type of the post body)
:accepts
:request_uri (the entire request uri)
:protocol (either http:// or https://)
http://svn.danwebb.net/external/rails/plugins/request_routing/trunk/
Rails' (MIT)
Misc. Enhancements

The url doesn't work anymore?
This works great, except I had to use
:conditions => {:subdomain => 'www'}
instead of
:requirements => {:subdomain => 'www'}