How can I create a Rails 3 route that will match all requests and direct to one resource / page?

后端 未结 4 1590
粉色の甜心
粉色の甜心 2021-02-07 03:50

I have a rails app (Rails 3.0) that I need to temporarily take out of service. While this is in effect, I want to create a new route that will direct all requests to a single pi

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 04:50

    I ran into something like this where I had domain names as a parameter in my route:

    match '/:domain_name/', :to => 'sitedetails#index', :domain_name => /.*/, :as =>'sitedetails'
    

    The key piece to this was the /.*/ which was a wildcard for pretty much anything. So maybe you could do something like:

    match '/:path/', :to => 'content#holding', :path=> /.*/, :as =>'whatever_you_want'
    

提交回复
热议问题