Routing in Rails for better URL
Using RoR 2.3.8.
Wondering, is there a开发者_JS百科 way to re-route such url?
Old:
http://localhost:3000/shops/16-white-cafe-house?type=cafes
New:
http://localhost:3000/cafes/16-white-cafe-house
I can think of one way, via namespace:
In rails 3, I would do:
namespace 'cafe' do
match '/:cafe_name(.:format)', :to => 'shop#show',
end
Which should generate urls like: http://localhost:3000/cafe/16-white-cafe-house
Perhaps you can dig up the Rails 2.3.8 guides for an equivalent code structure.
Hope that helps!
精彩评论