开发者

Rails 3.1 build GET form that creates a custom URL route that is SEO friendly

I would like to create custom SEO friendly routes similar to what is used by http://realestate.com.au For example the following page is shown by google when the search term "real estate melbourne" is used:

www.realestate.com.au/buy/in-melbourne,+vic+3000/list-1

I would like use the following format. mysite.com/trips/search/melbourne-to-sydney/01-01-2011

I have configured the routes in my routes.rb file to get it to pick up the correct parameters when a url is entered is this format.

routes.rb
    match '/trips/search(/:fl(-to-:tl(/:tripdate)))' => 'trips#someaction'

My question is how do I setup a form in rails 3 to send a GET request using the above url structure. I have tried playing around with to_params though it seems to then change all my edit, show links etc which is not intended. I could build the link using javascript though I guess this would be a hacky option and the site would not work if javascript was disabl开发者_Go百科ed.

Is there a neat way to be able to create a GET submit form in Rails 3.1? The fields are select lists containing name and ids.

Thanks for your help.


This will help you immensely with the friendly URL portion

http://norman.github.com/friendly_id/file.Guide.html

https://github.com/norman/friendly_id

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜