# Routing problem: extending matched route segment

**URL:** <https://www.ruby-forum.com/t/routing-problem-extending-matched-route-segment/110327>\
**Category:** Rails\
**Created:** [July 25, 2007, 11:47am UTC](https://www.ruby-forum.com/t/routing-problem-extending-matched-route-segment/110327 "2007-07-25T11:47:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [July 25, 2007, 11:47am UTC](https://www.ruby-forum.com/t/routing-problem-extending-matched-route-segment/110327/1 "2007-07-25T11:47:31Z")

</div>

Hi all,

I would like to route a request to a specific domain  
(‘request\_routing’ plugin installed) to controllers living in a  
subfolder for that domain like this:

[http://www.mydomain.com/home/index](http://www.mydomain.com/home/index)  
:controller =\> ‘mydomain/home’, :action =\> ‘index’

I would like to use a general route like ‘/:controller/:action’

Is it possible to somehow access the string matched by :controller,  
extend it and use the extended string as the controller, like the  
following?

# mydomain routes

map.with\_options :requirements =\> { :domain =\> /^mydomain/ } do |  
mydomain|  
mydomain.connect ‘:controller/:action’, :controller =\> “mydomain/  
#{controller\_match}”  
end

Thanks for any hint!  
Ingo
