2

我有一个 Rails 3 应用程序,它需要有指向我的代码库中的静态页面的子域

例子:

mk1.mysite.com需要显示所在页面

应用 > 视图 > 关于 > page.html.haml

该页面位于mysite.com/about/page.html

问题:

如何通过访问子域 ( mk1.mysite.com ) 配置路由以显示子目录 ( mysite.com/about/page.html ) 页面?

我的 routes.rb 中有这个

match '/' => 'about/page.html', :constraints => { :subdomain => 'mk1' }
4

1 回答 1

0

您的常规根路由在您的路由文件中的什么位置?它位于您在帖子中列出的行之前还是之后?

所以如果你有一条线

root :to => "foo#index" 

在您的路线文件中,上面

match '/' => 'about/page.html', :constraints => { :subdomain => 'mk1' }

将首先调用根路由,而不会调用您的子域路由。

于 2012-06-12T15:22:40.630 回答