Well, I’ve been hitting my head against a brick wall with this one - any
help much appreciated!
I’m redirecting old urls in my routes.rb file and for the most part
that’s working well, e.g.:
match ‘/pages/holiday-specials/’, :to => redirect( “/accommodation”,
:status => 301 )
However, I need a special catch-all rule that needs to do some regex
checking, so I have a final rule which contains a block. The code below
works well EXCEPT I can’t get it to pass the status, no matter what
combination I try.
match ‘/*:path’, :to => redirect( lambda { |params|
“/operator/#{/^\d([^\d]|$)/.match(params[:path])[1]}” }, :status
=> 301)
Any ideas? How do you perform a redirection with a block AND status
code?