http://aerial.st/archive/...
に来たアクセスを一律にhttp://archive.aerial.st/archive/...
にリダイレクトするようにした。
Rails.application.routes.draw do # (snip) get "archive/*path", to: redirect(subdomain: "archive", path: "/archive/%{path}") end
%{foo}
はparams[:foo]
の値が取れるみたい。
ちなみにデフォルトだと"301 Moved Parmanently"になるらしく、特定のステータスコードを指定する場合はstatus: 302
とかあわせて指定してくれとのこと。
参考
- Rails Routing from the Outside Inの3.11 Route Globbing and Wildcard Segmentsと3.12 Redirection
- ActionDispatch::Routing::Redirection#redirectのAPIリファレンス