简体   繁体   中英

rails3 : URL rewriting

I have a rails 3 application in which my users can belong to group. What I want to do is to transform the group's URLs.

The group's URLs are like that :

http://www.my_website/groups/group_id

What I want is to transform my URLs like that :

http://www.group_name.my_website

Exemple for the the 'driver' group :

http://www.my_website/groups/9  ==> http://www.driver.my_website

Is it possible with rails ?

Yes, just use request.subdomain instead of id . RailsCasts

RailsCast for you

Hope, It will solve your problem :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM