Advanced Rails Routing of short URL's and usernames off of root url

Posted by Michael Waxman on Stack Overflow See other posts from Stack Overflow or by Michael Waxman
Published on 2010-05-28T04:09:15Z Indexed on 2010/05/28 4:11 UTC
Read the original article Hit count: 387

Filed under:
|
|
|
|

I want to have username URL's and Base 58 short URL's to resources both off of the root url like this:

http://mydomain.com/username #=> goes to given user

http://mydomain.com/a3x9 #=> goes to given story

I am aware of the possibilities of a user names conflicting with short urls, and I have a workaround, but what I can't figure out is the best way to set this up in rails.

Can I do it in rails routes? Should I do something with a piece of Rack middleware? Should I set up a routing controller?

Please let me know the best way to do this. Thanks so much!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby