Question: I'm trying to re-route the root path based on the sub-domain request. I had browsed through few articles which mentioned 'constraints' in the routes for rails 3, as mentioned below

```
MyKillerApp::Application.routes.draw do |map|  
  resources :comments  
  resources :articles  
  resources :blogs
  constraints(Subdomain) do  
    match '/' => 'blogs#show'
  end
  root :to => "blogs#index"  
end

```

In `lib/subdomain.rb`

```
class Subdomain  
  def self.matches?(request)  
    request.subdomain.present? && request.subdomain != 'www'  
  end  
end

```

can the same be achieved in rails 2.3 ....?

Answer: 
```
I came around the problem using the subdomain-fu gem. Thanks for the help.... :-)

```
You don't have this feature implicitly in rails 2.3.x, it was with rails 3. You can always write your own method to do the mapping and route those links to that particular method and reroute from there.