基于虚拟主机的Rails路由(Host HTTP header)
是否可以根据请求 URL 的主机部分指定 Ruby on Rails 路由?
在 config/routes.rb 中,我有
root :to => 'entities#index'
,但我想使用相同的代码库来服务多个站点,每个站点都有自己的默认控制器。
Is it possible to specify a Ruby on Rails route based on the host part of the request URL?
In config/routes.rb, I have
root :to => 'entities#index'
but I would like to use the same code base to serve several sites, each with their own default controller.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 请求基本约束
希望这会有所帮助。
You can use Request Base Constraints
Hope this helps.