[Rails] Apache rewrite or Rails route?

Johan Sörensen johans at gmail.com
Sat Mar 19 14:59:44 GMT 2005


something like:

map.connect 'page/:id', :controller => 'page', :action => 'view'

should work fine for what you'd want I reckon.

-johan


On Sat, 19 Mar 2005 08:55:20 -0600, Tom Donovan <donovant at hawthorn73.org> wrote:
> A part of a homebrewed content management system that I'm trying to
> convert to RoR, I have relative URLs in the form:  "page$2" embedded in
> a text field in the database.  When displayed on a page, they look like
> this:
> 
>         http://hostname/page/page$2
> 
> I need them to look like this:
> 
>         http://hostname/page/2
> 
> My controller is "page", obviously, and the record ID is 2, so I'm part
> way there.  I know I can do it via a rewrite rule in .htaccess, but can
> it be done in with a route?  If so, how?  I'm new to Rails and have
> managed to wrap my head around routes for simple cases, but having
> figured out how to extract specific values.
> 
> Thanks for any help you can lend.
> 
> Tom
> 
> ------------------------------------------------------------------------
> ----
> Tom Donovan                                Hawthorn School District 73
> Mgr. of Tech. Systems, Webmaster           Vernon Hills, IL
> ------------------------------------------------------------------------
> ----
> 
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


More information about the Rails mailing list