# Routes and Requirements parameter question

**URL:** <https://www.ruby-forum.com/t/routes-and-requirements-parameter-question/182327>\
**Category:** Rails\
**Created:** [January 26, 2010, 5:01pm UTC](https://www.ruby-forum.com/t/routes-and-requirements-parameter-question/182327 "2010-01-26T17:01:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cswebgrl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/edb3f5/32.png) [@cswebgrl](https://www.ruby-forum.com/u/cswebgrl)\
**Post date:** [January 26, 2010, 5:01pm UTC](https://www.ruby-forum.com/t/routes-and-requirements-parameter-question/182327/1 "2010-01-26T17:01:52Z")

</div>

I have done very little with customizing routes so this is new for me.

I would like to send users to my users controller only if it follows a  
particular pattern. I think that I might be able to use requirements  
for this?

I’ve got this so far, but it’s not quite working.

map.user ‘:user’, :controller =\> ‘users’, :action =\> ‘show’,  
:requirements =\> {:user =\> /[-+]/ }

I want this url to work [www.domain.com/first-last](http://www.domain.com/first-last)

I want this domain to fail [www.domain.com/firstlast](http://www.domain.com/firstlast)

The problem is that “firstlast” goes to the users controller and fails.  
The only way to get out of it is a rescue with a redirect to a 404 page.  
I’d like to handle this in the routes instead of going to the  
controller.

Is that possible and if so, any help with what I have so far would be  
appreciated.

Thanks.
