How to Prefixing a controller path in a route

Hi, I’ve been playing with routes and with Jamis B.'s plugin for host
based routing (

Here’s what I have in routes.rb:

1 map.connect ‘’, :conditions => { :host =>
/www.example.(com| },
2 :controller => “example/portal”
4 map.connect ‘:controller/:action/:id’,
5 :conditions => { :host =>
/www.example.(com| },
6 :controller => “example/:controller”
8 # Default root
9 map.connect ‘’, :controller => “portal”
1 # Install the default route as the lowest priority.
2 map.connect ‘:controller/:action/:id.:format’
3 map.connect ‘:controller/:action/:id’

The first route at lines 1-2 fires on a request from”, causing the file
“controllers/example/portal_controller.rb” to be used.

Any other domain is picked up by line 13 and causes
controllers/portal_controller.rb" to be used.

The second route at lines 4-6 is supposed to fire on requests like” but all I get here is
“controllers/portal_controller.rb” being used (I suspect this is via the
route at line 13).

I need my route at line 4-6 to respond to requests for
" and fire
“controllers/example/controller” ?

I am pretty sure the code on line 6 is wrong but have no idea what it
should be to make this work.

I want to handle overlays for several different domains.

Many thanks.

As a further clarification, the following works for
http://www.example/com/xyz :

map.connect ‘xyz/:action/:id’,
:conditions => { :host => /www.example.(com|
:controller => “example/xyz”

I want to do the below, but it does not work:

map.connect ‘:controller/:action/:id’,
:conditions => { :host => /www.example.(com|
:controller => “example/:controller”

Any help greatly appreciated :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs