ruby on rails - How do I 301 redirect these route changes? -


i have couple routes this:

  match ':category/:brand/:permalink' => 'products#show', :as => :public_product   match 'stoves' => 'home#stoves', :as => :stoves 

i changed them this:

  match ':category/:brand/:permalink' => 'products#show', :as => :public_product   match 'wood_stoves' => 'home#wood_stoves', :as => :stoves 

i changed category record titled stoves wood_stoves.

can add route redirect allows wildcards change domain.com/stoves or domain.com/stoves/morso/8140-contemporary domain.com/wood_stoves or domain.com/wood_stoves/morso/8140-contemporary, respectively? or should put in apache virtualhost config block?

let route.rb this:

match ':category/:brand/:permalink' => 'products#show', :as => :public_product match 'stoves' => 'home#stoves', :as => :old_stoves # else except stoves match 'wood_stoves' => 'home#wood_stoves', :as => :stoves 

in home controller:

def stove   redirect_to stoves_path(# use parameters here when user hits link domain.com/stoves or domain.com/stoves/morso/8140-contemporary) end def wood_stoves   # code here.. end 

Comments