How can I implement vanity URL's in a Rails application?
问题 I want users to able to have a profile page at site.com/myNameHere. Rails looks for a controller named "myNameHere." Is it possible to setup routes.rb so that if the controller is not found, "myNameHere" gets sent as a parameter to another controller? 回答1: You can add a route like this: map.profile_link '/:username', :controller => 'profiles', :action => 'show' Be sure to add it low enough in the file, below your resources, that it doesn't interfere with other routes. It should be lowest