开发者

subdomain routing

开发者 https://www.devze.com 2022-12-17 16:32 出处:网络
When a user types in his username.example.com I read out the subdomain and render the users开发者_Python百科 personal page.

When a user types in his username.example.com I read out the subdomain and render the users开发者_Python百科 personal page.

map.home '', :controller => 'users', :action => 'show'

the problem is that I now want to add custom subdomains like www, '', help and so on.

What I do now but doesn't work: I read the subdomain in the applications controller and when I catch help I redirect to the helps controller. Redirecting doesn't work because applications controllers is calles again and I end up in a infinit loop.

Someone knows how I approach this?

Thanks


We use a plugin for this:

http://github.com/mbleigh/subdomain-fu

0

精彩评论

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