Forum: Ruby on Rails search engine friendly URL params?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
CodeNinja (Guest)
on 2005-12-31 06:50
I have a site which is a listing of realestate offerings, written
currently in PHP.

With complicated .htaccess rules, going to the url
site.com/listings/226/aid/29/ref/contact leads to the page
listings/prop_view.php?id=226&aid=29&ref=contact... the beauty of this
is that the link is SEO friendly and thus gains high rankings in the
engines because they will reach it.

question is, how would I do this in rails so that I get the same url and
not
site.com/listings/view/226?aid=29&ref=contact

I could write the link dynamicly (without helpers) in the view, but then
would rails seperate these into :params? or would I have to do somthing
else with the data to map it or connect it?

Thanks for helping a noob.
John W. (Guest)
on 2005-12-31 09:02
(Received via mailing list)
On 12/30/05, CodeNinja <removed_email_address@domain.invalid> wrote:
> question is, how would I do this in rails so that I get the same url and
> not
> site.com/listings/view/226?aid=29&ref=contact
>
> I could write the link dynamicly (without helpers) in the view, but then
> would rails seperate these into :params? or would I have to do somthing
> else with the data to map it or connect it?

The config/routes.rb file allows you to set up custom routing (similar
to mod_rewrite in many respects). It works both ways, so it also
affects how URLs in links are formed when using the helper methods in
your templates.

http://manuals.rubyonrails.com/read/chapter/65

--
Regards,
John W.
http://johnwilger.com

-----------
Alice came to a fork in the road. "Which road do I take?" she asked.
"Where do you want to go?" responded the Cheshire cat.
"I don't know," Alice answered.
"Then," said the cat, "it doesn't matter."
- Lewis Carrol, Alice in Wonderland
This topic is locked and can not be replied to.