I used to have PHP websites and using url rewriting on picture to have SEO friendly urls,
On php I had links like
/image/blablablabla-1234-blablabla
rewriting to:
/image/1234.jpg
by using a url rewrite rule on apache .htaccess file.
So I would like the structure /image/<text>-ID-<text> to return /image/<id>.jpg reguardless the text content.
Now I totally switched to ruby on rails and I would like to know what is the best way to do that on RoR? I am hosting websites on apache with passenger.
I guess the solution is in the rails route file but I can’t figure out the appropriate way to achieve this.
Thanks in advance.
A. Try the friendly_id plugin. You have this functionality out of the box.
friendly_id guide
B. Add a before_filter in your controller (to parse any kind of URL in that form)