我有一箇舊的wordpress woocommerce網站,我在rails中重建。重定向路線
顯然它有一個產品模型和產品控制器與路線。
該網站已準備好推出。
我唯一的問題是舊的鏈接去
www.mydomain.com/product/product-name
我怎麼要麼重定向或更改我的
www.mydomain.com/products/product-name
我的路線文件看起來像這樣
resources :products do
resource :like, only: [:create,:destroy], module: :products
resource :collect, only: [:create,:destroy], module: :products do
put :sort, on: :collection
end
member do
get :toggle_status
end
end
這正是我所需要的,它提供了一種很好的方式來確保我所有的反向鏈接都能正常工作,並且我可以使用新的應用程序改進邏輯。 –