How-to Pretty URLs with Subdomain using mod_rewrite, request

Does Rails 1.2 (EDGE) provide a native way to work seamlessly with
subdomains? For example, I would like the following incoming request to
be routed to the corresponding controller/action: => (:controller => sub1, :action => show)

I have been able to accomplish this using the “Request Routing” plugin
by specifying a subdomain condition.
map.connect ‘show’, :controller => ‘sub1’, :action => ‘show’,
:conditions => {:subdomain => ‘sub1’}

My first problem/question is will I have to map each action of a
subdomain/controller. Is there an easier way, possibly a one-liner?

My second problem is with the URLs generated by url_for and link_to
once the request has been directed to the correct controller/action.
How can one reverse the process? For example:
url_for(:controller => sub1, :action => show) =>

I also tried using Lighttpd’s mod_rewrite, but can’t get it to work
either. When using the following config, rails routing cannot find
route, essentially the rewritten URL is not given to rails. For
example, when I request:, Rails outputs the following:

no route found to match “/show” with {:domain=>“”,
:request_uri=>“/show”, :protocol=>“http://”, :accept
e/x-xbm,image/gif,application/postscript,/”, :remote_ip=>“”,
:method=>:get, :content_type=>nil, :po
rt=>3000, :subdomain=>“sub1”}

Any pointers will be greatly appreciated. Here is the relevant section
from config/lighttpd.conf:

$HTTP[“host”] =~ “^(.+)$” {
fastcgi.server = (“.fcgi” =>
( “localhost” =>
( “min-procs” => 1,
“max-procs” => 1,
“socket” => CWD + “/tmp/sockets/fcgi.socket”,
“bin-path” => CWD + “/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “development” )
url.rewrite-once = ( “^(.*)$” => “/%1/$1” )