Ruby on Rails wildcard routing such as /foo.htm /foo.php /foo.something

Posted by fregas on Stack Overflow See other posts from Stack Overflow or by fregas
Published on 2010-06-16T01:22:21Z Indexed on 2010/06/16 1:22 UTC
Read the original article Hit count: 358

Filed under:
|

I'm trying to create a routing situation where by default, any URL's such as this:

/foo

/something

/foo.php

/somethingelse.xml

/something.something.else

etc.

will all route to one controller, assuming they don't route anywhere else.

i can get this to work with the following code in my routes:

map.myroute '/:file_or_folder', :controller => 'mycontroller'

this works fine as long as there are no dots in the URL:

/something

but this wont work:

/something.foo

any ideas?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routing