Wildcard matching for Rails API Versioning causes infinite redirect
问题 I was following the excellent solution posted here regarding versioning an API using Rails routing, but I keep running into an infinite redirect. Here is a section of my routes.rb namespace :api do namespace :v1 do resources :books end namespace :v2 do resources :books end match 'v:api/*path', :to => redirect("/api/v2/%{path}") match '*path', :to => redirect("/api/v2/%{path}") end which is virtually the same as the posted answer. Accessing /api/v1/books/list.json works as expected as does api