开发者

avoiding redirect

开发者 https://www.devze.com 2022-12-13 02:34 出处:网络
Depending on the subdomain I want to call a specific controller. What I currently do: My page uses the subdomain to identify users like username.site.com. I get the username, look it up in the databa

Depending on the subdomain I want to call a specific controller.

What I currently do: My page uses the subdomain to identify users like username.site.com. I get the username, look it up in the database and render the appropriate data in the UsernamesController.

the only exception to this is www.site.com or site.com . In that case another controller should be called. I currently do this by detecting the www o开发者_如何学Pythonr '' subdomain in `ApplicationController and then redirecting. Although I feel that a redirect is not in it's place here.

Someone has another approach?

Thanks


subdomains_routes allows you to define custom routes based on current subdomain.

0

精彩评论

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