# Routes problem

**URL:** <https://www.ruby-forum.com/t/routes-problem/150782>\
**Category:** Rails\
**Created:** [October 13, 2008, 9:34am UTC](https://www.ruby-forum.com/t/routes-problem/150782 "2008-10-13T09:34:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdiazl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a88e4f/32.png) [@gdiazl](https://www.ruby-forum.com/u/gdiazl)\
**Post date:** [October 13, 2008, 9:34am UTC](https://www.ruby-forum.com/t/routes-problem/150782/1 "2008-10-13T09:34:46Z")

</div>

Hello,

Just a single problem i can’t solve. The scenario…

I have a controller called “places” but i don’t want to link the users  
to /places/whatever, i want something like /no/whatever. How to  
achieve this?

I have in my routes.rb:

map.resources :no, :controller =\> “places”,

map.connect ‘:controller/:action/:id’  
map.connect ‘:controller/:action/:id.:format’

My problem is that i don’t want to have 2 urls pointing to the same  
page. If I type “/places/whatever” i got the same as if i type “/no/  
whatever”

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![gdiazl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a88e4f/32.png) [@gdiazl](https://www.ruby-forum.com/u/gdiazl)\
**Post date:** [October 13, 2008, 11:01am UTC](https://www.ruby-forum.com/t/routes-problem/150782/2 "2008-10-13T11:01:41Z")

</div>

On Oct 13, 10:30 am, gdiazl [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> map.resources :no, :controller =\> “places”,
> 
> map.connect ‘:controller/:action/:id’  
> map.connect ‘:controller/:action/:id.:format’
> 
> My problem is that i don’t want to have 2 urls pointing to the same  
> page. If I type “/places/whatever” i got the same as if i type “/no/  
> whatever”

/places/whatever is going to be there because of the default routes  
above: ie  
map.connect ':controller/:action/:id  
You probably don’t want to mess with that setting either.

If you really want to use /places/ for something else, then  
you’d  
need to put a new rule in above the default rules to override them;  
something like:  
map.connect ‘places/:action/:id’ , :controller =\>  
‘some\_other\_controller’  
Seems unlikely you’d want to do that.  
So, I think living with the two routes isn’t a problem.

If you really wanted to shut it off, I guess you could have  
‘some\_other\_controller’ send back an http status of 500 or something.  
map.connect ‘places’ , :controller =\>  
‘some\_other\_controller’ , :action =\> ‘warn’

I defer to a routing expert though.

Daniel
