I've got a couple routes such as this:
match ':category/:brand/:permalink' => 'products#show', :as => :public_product
match 'stoves' => 'home#stoves', :as => :stoves
I transformed these to this:
match ':category/:brand/:permalink' => 'products#show', :as => :public_product
match 'wood_stoves' => 'home#wood_stoves', :as => :stoves
I transformed the course record entitled stoves
to wood_stoves
.
Can One give a route redirect that enables for wildcards that will change anything like domain.com/stoves
or domain.com/stoves/morso/8140-contemporary
to domain.com/wood_stoves
or domain.com/wood_stoves/morso/8140-contemporary
, correspondingly? Or must i put this during my apache virtualhost config block?
Give your route.rb to become such as this:
match ':category/:brand/:permalink' => 'products#show', :as => :public_product
match 'stoves' => 'home#stoves', :as => :old_stoves # anything else except stoves
match 'wood_stoves' => 'home#wood_stoves', :as => :stoves
In your house Controller:
def stove
redirect_to stoves_path(# Use parameters here when a user hits a link like domain.com/stoves or domain.com/stoves/morso/8140-contemporary)
end
def wood_stoves
# your code here..
end