title: Defining a default route for a subdomain within Ruby on Rails
body: <p>I'm trying to setup a subdomain within my Rails 2.3.10 application, using SubdomainFu - trying to setup m.domainname.com  The aspect that I'm struggling with is trying to define a default route for the subdomain that is different than the default route for the main application.</p>
  
  <p>If this is my route namespace for my subdomain:</p>
  
  <pre><code>map.namespace :mobile, :path_prefix =&gt; '', :conditions =&gt; { :subdomain =&gt; 'm' } do |mobile|
    map.connect '/', :controller =&gt; 'mobile/mobile'
  end
  </code></pre>
  
  <p>and then a little further down in my routes file, I have my default route:</p>
  
  <pre><code>map.default '/', :controller =&gt; 'pages', :action =&gt; 'home'
  </code></pre>
  
  <p>The default route for the namespace is overriding the main default route.  If I move the primary default route above the namespace, then it takes precedence.</p>
  
  <p>Any suggestions on how to best structure the route file and define a default route for the subdomain?</p>
  
  <p>Thanks!</p>