Rails matching PHP

At first the problem: After the VegiKochbuch relaunch as Rails project I realized that all old links to recipes are broken and this causes a lot of 404 errors.

The old PHP link structure was: http://vegikochbuch.de/rezepte/rezept175.php
And now in Rails it’s: http://vegikochbuch.de/recipes/175

My solution was adding

match '/rezepte/rezept:id.php' => 'recipes#show'

to routes.rb

It works and is realy simple. I don’t really know if this is the best way, but I like it!


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>